Small usability nits

This commit is contained in:
cpq 2023-01-27 09:36:16 +00:00
parent e635d5f748
commit 84893ec582
5 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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"

View File

@ -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++] = ' ';

View File

@ -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;
}

View File

@ -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++] = ' ';