diff --git a/docs/README.md b/docs/README.md index 74de0ebc..76f31487 100644 --- a/docs/README.md +++ b/docs/README.md @@ -283,12 +283,12 @@ struct mg_connection { In the Operating System environment, Mongoose uses BSD sockets API provided by the OS's TCP/IP stack: -![](images/arch2.svg) +![Mongoose in OS environment](images/arch2.svg) In the embedded bare metal environment, Mongoose can utilise its own built-in stack with network drivers - i.e. it can run directly on top of the hardware: -![](images/arch1.svg) +![Mongoose in bare metal environment](images/arch1.svg) ## Build options diff --git a/examples/http-restful-server/Makefile b/examples/http-restful-server/Makefile index 51d9e194..a4c9c3f0 100644 --- a/examples/http-restful-server/Makefile +++ b/examples/http-restful-server/Makefile @@ -3,7 +3,7 @@ CFLAGS ?= -W -Wall -DMG_ENABLE_LINES=1 SSL = ? ifeq "$(SSL)" "MBEDTLS" -CFLAGS += -DMG_ENABLE_MBEDTLS=1 -lmbedtls -lmbedcrypto -lmbedx509 +CFLAGS += -DMG_ENABLE_MBEDTLS=1 -lmbedtls -lmbedcrypto -lmbedx509 -I$(MBEDTLS)/include -I/usr/include -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509 endif ifeq "$(SSL)" "OPENSSL" diff --git a/mongoose.c b/mongoose.c index aa533628..ae76f1c4 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1685,10 +1685,10 @@ void mg_http_reply(struct mg_connection *c, int code, const char *headers, mg_vxprintf(mg_pfn_iobuf, &c->send, fmt, &ap); va_end(ap); if (c->send.len > 15) { - mg_snprintf((char *) &c->send.buf[len - 14], 11, "%010lu", - (unsigned long) (c->send.len - len)); + size_t n = mg_snprintf((char *) &c->send.buf[len - 14], 11, "%-10lu", + (unsigned long) (c->send.len - len)); + c->send.buf[len - 14 + n] = ' '; // Change ending 0 to space c->is_resp = 0; - c->send.buf[len - 4] = '\r'; // Change ending 0 to space } c->is_resp = 0; } @@ -2803,7 +2803,7 @@ bool mg_log_prefix(int level, const char *file, int line, const char *fname) { char buf[41]; size_t n; if (p == NULL) p = strrchr(file, '\\'); - n = mg_snprintf(buf, sizeof(buf), "%llx %d %s:%d:%s", mg_millis(), level, + n = mg_snprintf(buf, sizeof(buf), "%-6llx %d %s:%d:%s", mg_millis(), level, p == NULL ? file : p + 1, line, fname); if (n > sizeof(buf) - 2) n = sizeof(buf) - 2; while (n < sizeof(buf)) buf[n++] = ' '; diff --git a/src/http.c b/src/http.c index 62bd42c2..4d6d36f5 100644 --- a/src/http.c +++ b/src/http.c @@ -325,10 +325,10 @@ void mg_http_reply(struct mg_connection *c, int code, const char *headers, mg_vxprintf(mg_pfn_iobuf, &c->send, fmt, &ap); va_end(ap); if (c->send.len > 15) { - mg_snprintf((char *) &c->send.buf[len - 14], 11, "%010lu", - (unsigned long) (c->send.len - len)); + size_t n = mg_snprintf((char *) &c->send.buf[len - 14], 11, "%-10lu", + (unsigned long) (c->send.len - len)); + c->send.buf[len - 14 + n] = ' '; // Change ending 0 to space c->is_resp = 0; - c->send.buf[len - 4] = '\r'; // Change ending 0 to space } c->is_resp = 0; } diff --git a/src/log.c b/src/log.c index 40e9b781..72f32bad 100644 --- a/src/log.c +++ b/src/log.c @@ -37,7 +37,7 @@ bool mg_log_prefix(int level, const char *file, int line, const char *fname) { char buf[41]; size_t n; if (p == NULL) p = strrchr(file, '\\'); - n = mg_snprintf(buf, sizeof(buf), "%llx %d %s:%d:%s", mg_millis(), level, + n = mg_snprintf(buf, sizeof(buf), "%-6llx %d %s:%d:%s", mg_millis(), level, p == NULL ? file : p + 1, line, fname); if (n > sizeof(buf) - 2) n = sizeof(buf) - 2; while (n < sizeof(buf)) buf[n++] = ' ';