mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-18 23:53:15 +08:00
Small usability nits
This commit is contained in:
parent
e635d5f748
commit
84893ec582
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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++] = ' ';
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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++] = ' ';
|
||||
|
Loading…
Reference in New Issue
Block a user