diff --git a/vendor/mongoose.c b/vendor/mongoose.c index b0cfec1..e2088d0 100644 --- a/vendor/mongoose.c +++ b/vendor/mongoose.c @@ -1700,7 +1700,7 @@ int mg_str_starts_with(struct mg_str s, struct mg_str prefix) { return (mg_strcmp(sp, prefix) == 0); } #ifdef MG_MODULE_LINES -#line 1 "common/str_util.c" +#line 1 "src/common/str_util.c" #endif #ifndef EXCLUDE_COMMON @@ -2219,7 +2219,7 @@ size_t mg_match_prefix(const char *pattern, int pattern_len, const char *str) { #endif /* EXCLUDE_COMMON */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net.c" +#line 1 "src/mg_net.c" #endif /* Amalgamated: #include "common/cs_time.h" */ @@ -2913,13 +2913,13 @@ static int mg_recv_udp(struct mg_connection *nc, char *buf, size_t len) { } else { mbuf_append(&nc->recv_mbuf, buf, n); } - mbuf_trim(&lc->recv_mbuf); lc->last_io_time = nc->last_io_time = (time_t) mg_time(); #if !defined(NO_LIBC) && MG_ENABLE_HEXDUMP if (nc->mgr && nc->mgr->hexdump_file != NULL) { mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, n, MG_EV_RECV); } #endif + mbuf_trim(&lc->recv_mbuf); if (n != 0) { mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n); } @@ -3415,7 +3415,7 @@ double mg_time(void) { return cs_time(); } #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if_socket.h" +#line 1 "src/mg_net_if_socket.h" #endif #ifndef CS_MONGOOSE_SRC_NET_IF_SOCKET_H_ @@ -3439,7 +3439,7 @@ extern const struct mg_iface_vtable mg_socket_iface_vtable; #endif /* CS_MONGOOSE_SRC_NET_IF_SOCKET_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if_socks.h" +#line 1 "src/mg_net_if_socks.h" #endif #ifndef CS_MONGOOSE_SRC_NET_IF_SOCKS_H_ @@ -3460,7 +3460,7 @@ extern const struct mg_iface_vtable mg_socks_iface_vtable; #endif /* MG_ENABLE_SOCKS */ #endif /* CS_MONGOOSE_SRC_NET_IF_SOCKS_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if.c" +#line 1 "src/mg_net_if.c" #endif /* Amalgamated: #include "mg_net_if.h" */ /* Amalgamated: #include "mg_internal.h" */ @@ -3516,7 +3516,7 @@ double mg_mgr_min_timer(const struct mg_mgr *mgr) { return min_timer; } #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if_null.c" +#line 1 "src/mg_net_if_null.c" #endif static void mg_null_if_connect_tcp(struct mg_connection *c, @@ -3643,7 +3643,7 @@ const struct mg_iface_vtable mg_null_iface_vtable = MG_NULL_IFACE_VTABLE; const struct mg_iface_vtable mg_default_iface_vtable = MG_NULL_IFACE_VTABLE; #endif /* MG_NET_IF == MG_NET_IF_NULL */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if_socket.c" +#line 1 "src/mg_net_if_socket.c" #endif #if MG_ENABLE_NET_IF_SOCKET @@ -4223,7 +4223,7 @@ const struct mg_iface_vtable mg_default_iface_vtable = MG_SOCKET_IFACE_VTABLE; #endif /* MG_ENABLE_NET_IF_SOCKET */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if_socks.c" +#line 1 "src/mg_net_if_socks.c" #endif #if MG_ENABLE_SOCKS @@ -4459,7 +4459,7 @@ struct mg_iface *mg_socks_mk_iface(struct mg_mgr *mgr, const char *proxy_addr) { #endif #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_ssl_if_openssl.c" +#line 1 "src/mg_ssl_if_openssl.c" #endif #if MG_ENABLE_SSL && MG_SSL_IF == MG_SSL_IF_OPENSSL @@ -4469,10 +4469,13 @@ struct mg_iface *mg_socks_mk_iface(struct mg_mgr *mgr, const char *proxy_addr) { #endif #include +#include #ifndef KR_VERSION #include #endif +static const char *mg_default_session_id_context = "mongoose"; + struct mg_ssl_if_ctx { SSL *ssl; SSL_CTX *ssl_ctx; @@ -4534,6 +4537,10 @@ enum mg_ssl_if_result mg_ssl_if_conn_init( SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_SSLv2); SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_SSLv3); SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_TLSv1); + SSL_CTX_set_session_id_context( + ctx->ssl_ctx, + (const unsigned char *) mg_default_session_id_context, + strlen(mg_default_session_id_context)); #ifdef MG_SSL_OPENSSL_NO_COMPRESSION SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_COMPRESSION); #endif @@ -4591,6 +4598,17 @@ static enum mg_ssl_if_result mg_ssl_if_ssl_err(struct mg_connection *nc, int res) { struct mg_ssl_if_ctx *ctx = (struct mg_ssl_if_ctx *) nc->ssl_if_data; int err = SSL_get_error(ctx->ssl, res); + /* + * We've just fetched the last error from the queue. + * Now we need to clear the error queue. If we do not, then the following + * can happen (actually reported): + * - A new connection is accept()-ed with cert error (e.g. self-signed cert) + * - Since all accept()-ed connections share listener's context, + * - *ALL* SSL accepted connection report read error on the next poll cycle. + * Thus a single errored connection can close all the rest, unrelated ones. + * Clearing the error keeps the shared SSL_CTX in an OK state. + */ + ERR_clear_error(); if (err == SSL_ERROR_WANT_READ) return MG_SSL_WANT_READ; if (err == SSL_ERROR_WANT_WRITE) return MG_SSL_WANT_WRITE; DBG(("%p %p SSL error: %d %d", (void*)nc, (void*)ctx->ssl_ctx, res, err)); @@ -4855,7 +4873,7 @@ const char *mg_set_ssl(struct mg_connection *nc, const char *cert, #endif /* MG_ENABLE_SSL && MG_SSL_IF == MG_SSL_IF_OPENSSL */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_ssl_if_mbedtls.c" +#line 1 "src/mg_ssl_if_mbedtls.c" #endif #if MG_ENABLE_SSL && MG_SSL_IF == MG_SSL_IF_MBEDTLS @@ -5369,7 +5387,7 @@ int mg_ssl_if_mbed_random(void *ctx, unsigned char *buf, size_t len) { #endif /* MG_ENABLE_SSL && MG_SSL_IF == MG_SSL_IF_MBEDTLS */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_uri.c" +#line 1 "src/mg_uri.c" #endif /* Amalgamated: #include "mg_internal.h" */ @@ -5629,7 +5647,7 @@ out: return result; } #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http.c" +#line 1 "src/mg_http.c" #endif #if MG_ENABLE_HTTP @@ -5803,7 +5821,10 @@ struct mg_http_proto_data { struct mg_http_endpoint *endpoints; mg_event_handler_t endpoint_handler; struct mg_reverse_proxy_data reverse_proxy_data; - size_t rcvd; /* How many bytes we have received. */ + size_t rcvd; /* How many bytes we have received. */ + size_t body_rcvd; /* How many bytes of body we have received. */ + size_t body_processed; /* How many bytes of body we have processed. */ + int finished; }; static void mg_http_proto_data_destructor(void *proto_data); @@ -5865,7 +5886,7 @@ static void mg_http_free_proto_data_endpoints(struct mg_http_endpoint **ep) { current = tmp; } - ep = NULL; + *ep = NULL; } static void mg_http_free_reverse_proxy_data(struct mg_reverse_proxy_data *rpd) { @@ -6034,6 +6055,7 @@ static int mg_http_get_request_len(const char *s, int buf_len) { static const char *mg_http_parse_headers(const char *s, const char *end, int len, struct http_message *req) { int i = 0; + req->content_length = MG_HTTP_CONTENT_LENGTH_UNKNOWN; while (i < (int) ARRAY_SIZE(req->header_names) - 1) { struct mg_str *k = &req->header_names[i], *v = &req->header_values[i]; @@ -6059,9 +6081,10 @@ static const char *mg_http_parse_headers(const char *s, const char *end, break; } - if (!mg_ncasecmp(k->p, "Content-Length", 14)) { + if (mg_ncasecmp(k->p, "Content-Length", 14) == 0) { req->body.len = (size_t) to64(v->p); req->message.len = len + req->body.len; + req->content_length = req->body.len; } i++; @@ -6177,6 +6200,7 @@ static void mg_http_transfer_file_data(struct mg_connection *nc) { pd->file.keepalive)); if (!pd->file.keepalive) nc->flags |= MG_F_SEND_AND_CLOSE; mg_http_free_proto_data_file(&pd->file); + pd->finished = 1; } } else if (pd->file.type == DATA_PUT) { struct mbuf *io = &nc->recv_mbuf; @@ -6189,6 +6213,7 @@ static void mg_http_transfer_file_data(struct mg_connection *nc) { if (n == 0 || pd->file.sent >= pd->file.cl) { if (!pd->file.keepalive) nc->flags |= MG_F_SEND_AND_CLOSE; mg_http_free_proto_data_file(&pd->file); + pd->finished = 1; } } #if MG_ENABLE_HTTP_CGI @@ -6344,13 +6369,26 @@ static void mg_http_call_endpoint_handler(struct mg_connection *nc, int ev, struct http_message *hm); static void deliver_chunk(struct mg_connection *c, struct http_message *hm, - int req_len) { + struct mg_http_proto_data *pd, int req_len) { /* Incomplete message received. Send MG_EV_HTTP_CHUNK event */ hm->body.len = c->recv_mbuf.len - req_len; + if (hm->content_length != MG_HTTP_CONTENT_LENGTH_UNKNOWN) { + size_t body_remain = hm->content_length - pd->body_processed; + if (hm->body.len > body_remain) { + hm->body.len = body_remain; + } + } + if (pd != NULL) { + pd->body_rcvd = pd->body_processed + hm->body.len; + } c->flags &= ~MG_F_DELETE_CHUNK; mg_call(c, c->handler, c->user_data, MG_EV_HTTP_CHUNK, hm); /* Delete processed data if user set MG_F_DELETE_CHUNK flag */ - if (c->flags & MG_F_DELETE_CHUNK) c->recv_mbuf.len = req_len; + if (c->flags & MG_F_DELETE_CHUNK) { + pd->body_processed += hm->body.len; + c->recv_mbuf.len = req_len; + hm->body.len = 0; + } } /* @@ -6421,7 +6459,7 @@ void mg_http_handler(struct mg_connection *nc, int ev, int ev2 = is_req ? MG_EV_HTTP_REQUEST : MG_EV_HTTP_REPLY; hm->message.len = io->len; hm->body.len = io->buf + io->len - hm->body.p; - deliver_chunk(nc, hm, req_len); + deliver_chunk(nc, hm, pd, req_len); mg_http_call_endpoint_handler(nc, ev2, hm); } if (pd != NULL && pd->endpoint_handler != NULL && @@ -6433,6 +6471,8 @@ void mg_http_handler(struct mg_connection *nc, int ev, #if MG_ENABLE_FILESYSTEM if (pd != NULL && pd->file.fp != NULL) { mg_http_transfer_file_data(nc); + if (pd->finished) { + } } #endif @@ -6457,8 +6497,7 @@ void mg_http_handler(struct mg_connection *nc, int ev, again: req_len = mg_parse_http(io->buf, io->len, hm, is_req); - - if (req_len > 0) { + if (req_len > 0 && (pd == NULL || pd->finished)) { /* New request - new proto data */ pd = mg_http_create_proto_data(nc); pd->rcvd = io->len; @@ -6540,42 +6579,50 @@ void mg_http_handler(struct mg_connection *nc, int ev, } } #endif /* MG_ENABLE_HTTP_WEBSOCKET */ - else if (hm->message.len > pd->rcvd) { - /* Not yet received all HTTP body, deliver MG_EV_HTTP_CHUNK */ - deliver_chunk(nc, hm, req_len); - if (nc->recv_mbuf_limit > 0 && nc->recv_mbuf.len >= nc->recv_mbuf_limit) { - LOG(LL_ERROR, ("%p recv buffer (%lu bytes) exceeds the limit " - "%lu bytes, and not drained, closing", - (void*)nc, (unsigned long) nc->recv_mbuf.len, - (unsigned long) nc->recv_mbuf_limit)); - nc->flags |= MG_F_CLOSE_IMMEDIATELY; - } - } else { - /* We did receive all HTTP body. */ - int request_done = 1; - int trigger_ev = nc->listener ? MG_EV_HTTP_REQUEST : MG_EV_HTTP_REPLY; - char addr[32]; - mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr), - MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT); - DBG(("%p %s %.*s %.*s", (void*)nc, addr, (int) hm->method.len, hm->method.p, - (int) hm->uri.len, hm->uri.p)); - deliver_chunk(nc, hm, req_len); - /* Whole HTTP message is fully buffered, call event handler */ - mg_http_call_endpoint_handler(nc, trigger_ev, hm); - mbuf_remove(io, hm->message.len); - pd->rcvd -= hm->message.len; + else { + deliver_chunk(nc, hm, pd, req_len); + if (hm->message.len > pd->rcvd && + (hm->content_length == MG_HTTP_CONTENT_LENGTH_UNKNOWN || + pd->body_rcvd < hm->content_length)) { + /* Not yet received all HTTP body, deliver MG_EV_HTTP_CHUNK */ + if (nc->recv_mbuf_limit > 0 && + nc->recv_mbuf.len >= nc->recv_mbuf_limit) { + LOG(LL_ERROR, ("%p recv buffer (%lu bytes) exceeds the limit " + "%lu bytes, and not drained, closing", + (void*)nc, (unsigned long) nc->recv_mbuf.len, + (unsigned long) nc->recv_mbuf_limit)); + nc->flags |= MG_F_CLOSE_IMMEDIATELY; + } + } else { + /* We did receive all HTTP body. */ + int request_done = 1; + int trigger_ev = nc->listener ? MG_EV_HTTP_REQUEST : MG_EV_HTTP_REPLY; + char addr[32]; + mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr), + MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT); + DBG(("%p %s %.*s %.*s", (void*)nc, addr, (int) hm->method.len, hm->method.p, + (int) hm->uri.len, hm->uri.p)); + /* Whole HTTP message is fully buffered, call event handler */ + mg_http_call_endpoint_handler(nc, trigger_ev, hm); + mbuf_remove(io, req_len + hm->body.len); + pd->rcvd -= hm->message.len; + pd->body_rcvd = 0; #if MG_ENABLE_FILESYSTEM - /* We don't have a generic mechanism of communicating that we are done - * responding to a request (should probably add one). But if we are - * serving - * a file, we are definitely not done. */ - if (pd->file.fp != NULL) request_done = 0; + /* We don't have a generic mechanism of communicating that we are done + * responding to a request (should probably add one). But if we are + * serving + * a file, we are definitely not done. */ + if (pd->file.fp != NULL) request_done = 0; #endif #if MG_ENABLE_HTTP_CGI - /* If this is a CGI request, we are not done either. */ - if (pd->cgi.cgi_nc != NULL) request_done = 0; + /* If this is a CGI request, we are not done either. */ + if (pd->cgi.cgi_nc != NULL) request_done = 0; #endif - if (request_done && io->len > 0) goto again; + pd->finished = request_done; + DBG(("%p finished %d ml %d bl %d", (void*)nc, pd->finished, + (int) hm->message.len, (int) hm->body.len)); + if (request_done && io->len > 0) goto again; + } } } } @@ -7731,7 +7778,7 @@ static void mg_print_dir_entry(struct mg_connection *nc, const char *file_name, href = mg_url_encode(mg_mk_str(file_name)); mg_printf_http_chunk(nc, "%s%s" - "%s%s\n", + "%s%s", href.p, slash, path, slash, mod, is_dir ? -1 : fsize, size); free((void *) href.p); @@ -7797,23 +7844,24 @@ static void mg_send_directory_listing(struct mg_connection *nc, const char *dir, mg_printf_http_chunk( nc, - "Index of %.*s%s%s" + "Index of %.*s%s%s" "\n" - "

Index of %.*s

\n" - "" - "\n" - "\n" - "", + "font-family: monospace; }" + "

Index of %.*s

Name" - "Modified" - "Size

" + "" + "" + "" + "" + "", (int) hm->uri.len, hm->uri.p, sort_js_code, sort_js_code2, (int) hm->uri.len, hm->uri.p); mg_scan_directory(nc, dir, opts, mg_print_dir_entry); mg_printf_http_chunk(nc, - "\n" - "
Name" + "ModifiedSize


\n" - "
%s
\n" + "" + "
" + "" + "
%s
" "", mg_version_header); mg_send_http_chunk(nc, "", 0); @@ -8788,7 +8836,7 @@ void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path, #endif /* MG_ENABLE_HTTP */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http_cgi.c" +#line 1 "src/mg_http_cgi.c" #endif #ifndef _WIN32 @@ -9300,7 +9348,7 @@ MG_INTERNAL void mg_http_free_proto_data_cgi(struct mg_http_proto_data_cgi *d) { #endif /* MG_ENABLE_HTTP && MG_ENABLE_HTTP_CGI */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http_ssi.c" +#line 1 "src/mg_http_ssi.c" #endif #if MG_ENABLE_HTTP && MG_ENABLE_HTTP_SSI && MG_ENABLE_FILESYSTEM @@ -9320,7 +9368,7 @@ static void mg_send_file_data(struct mg_connection *nc, FILE *fp) { static void mg_do_ssi_include(struct mg_connection *nc, struct http_message *hm, const char *ssi, char *tag, int include_level, const struct mg_serve_http_opts *opts) { - char file_name[MG_MAX_PATH], path[MG_MAX_PATH + 1], *p; + char file_name[MG_MAX_PATH], path[MG_MAX_PATH], *p; FILE *fp; /* @@ -9329,13 +9377,15 @@ static void mg_do_ssi_include(struct mg_connection *nc, struct http_message *hm, */ if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) { /* File name is relative to the webserver root */ - snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name); + if (snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name) < 0) { + return; + } } else if (sscanf(tag, " abspath=\"%[^\"]\"", file_name) == 1) { /* * File name is relative to the webserver working directory * or it is absolute system path */ - snprintf(path, sizeof(path), "%s", file_name); + if (snprintf(path, sizeof(path), "%s", file_name) < 0) return; } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 || sscanf(tag, " \"%[^\"]\"", file_name) == 1) { /* File name is relative to the currect document */ @@ -9500,7 +9550,7 @@ MG_INTERNAL void mg_handle_ssi_request(struct mg_connection *nc, #endif /* MG_ENABLE_HTTP_SSI && MG_ENABLE_HTTP && MG_ENABLE_FILESYSTEM */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http_webdav.c" +#line 1 "src/mg_http_webdav.c" #endif #if MG_ENABLE_HTTP && MG_ENABLE_HTTP_WEBDAV @@ -9768,7 +9818,7 @@ MG_INTERNAL void mg_handle_put(struct mg_connection *nc, const char *path, #endif /* MG_ENABLE_HTTP && MG_ENABLE_HTTP_WEBDAV */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http_websocket.c" +#line 1 "src/mg_http_websocket.c" #endif #if MG_ENABLE_HTTP && MG_ENABLE_HTTP_WEBSOCKET @@ -10286,7 +10336,7 @@ struct mg_connection *mg_connect_ws( } #endif /* MG_ENABLE_HTTP && MG_ENABLE_HTTP_WEBSOCKET */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_util.c" +#line 1 "src/mg_util.c" #endif /* Amalgamated: #include "common/cs_base64.h" */ @@ -10629,7 +10679,7 @@ struct mg_str mg_url_encode(const struct mg_str src) { return mg_url_encode_opt(src, mg_mk_str("._-$,;~()/"), 0); } #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_mqtt.c" +#line 1 "src/mg_mqtt.c" #endif #if MG_ENABLE_MQTT @@ -11161,7 +11211,7 @@ void mg_mqtt_disconnect(struct mg_connection *nc) { #endif /* MG_ENABLE_MQTT */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_mqtt_server.c" +#line 1 "src/mg_mqtt_server.c" #endif /* Amalgamated: #include "mg_internal.h" */ @@ -11354,7 +11404,7 @@ struct mg_mqtt_session *mg_mqtt_next(struct mg_mqtt_broker *brk, #endif /* MG_ENABLE_MQTT_BROKER */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_dns.c" +#line 1 "src/mg_dns.c" #endif #if MG_ENABLE_DNS @@ -11734,7 +11784,7 @@ void mg_set_protocol_dns(struct mg_connection *nc) { #endif /* MG_ENABLE_DNS */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_dns_server.c" +#line 1 "src/mg_dns_server.c" #endif #if MG_ENABLE_DNS_SERVER @@ -11804,7 +11854,7 @@ int mg_dns_reply_record(struct mg_dns_reply *reply, #endif /* MG_ENABLE_DNS_SERVER */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_resolv.c" +#line 1 "src/mg_resolv.c" #endif #if MG_ENABLE_ASYNC_RESOLVER @@ -12095,7 +12145,7 @@ void mg_set_nameserver(struct mg_mgr *mgr, const char *nameserver) { #endif /* MG_ENABLE_ASYNC_RESOLVER */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_coap.c" +#line 1 "src/mg_coap.c" #endif /* Amalgamated: #include "mg_internal.h" */ @@ -12679,7 +12729,7 @@ int mg_set_protocol_coap(struct mg_connection *nc) { #endif /* MG_ENABLE_COAP */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_sntp.c" +#line 1 "src/mg_sntp.c" #endif /* Amalgamated: #include "mg_internal.h" */ @@ -12966,7 +13016,7 @@ struct mg_connection *mg_sntp_get_time(struct mg_mgr *mgr, #endif /* MG_ENABLE_SNTP */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_socks.c" +#line 1 "src/mg_socks.c" #endif #if MG_ENABLE_SOCKS @@ -13124,7 +13174,7 @@ void mg_set_protocol_socks(struct mg_connection *c) { } #endif #ifdef MG_MODULE_LINES -#line 1 "common/platforms/cc3200/cc3200_libc.c" +#line 1 "src/common/platforms/cc3200/cc3200_libc.c" #endif #if CS_PLATFORM == CS_P_CC3200 @@ -13226,7 +13276,7 @@ int _isatty(int fd) { #endif /* CS_PLATFORM == CS_P_CC3200 */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/msp432/msp432_libc.c" +#line 1 "src/common/platforms/msp432/msp432_libc.c" #endif #if CS_PLATFORM == CS_P_MSP432 @@ -13243,7 +13293,7 @@ int gettimeofday(struct timeval *tp, void *tzp) { #endif /* CS_PLATFORM == CS_P_MSP432 */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/nrf5/nrf5_libc.c" +#line 1 "src/common/platforms/nrf5/nrf5_libc.c" #endif #if (CS_PLATFORM == CS_P_NRF51 || CS_PLATFORM == CS_P_NRF52) && \ @@ -13256,7 +13306,7 @@ int gettimeofday(struct timeval *tp, void *tzp) { } #endif #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_fs_slfs.h" +#line 1 "src/common/platforms/simplelink/sl_fs_slfs.h" #endif #ifndef CS_COMMON_PLATFORMS_SIMPLELINK_SL_FS_SLFS_H_ @@ -13291,7 +13341,7 @@ void fs_slfs_unset_file_flags(const char *name); #endif /* CS_COMMON_PLATFORMS_SIMPLELINK_SL_FS_SLFS_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_fs_slfs.c" +#line 1 "src/common/platforms/simplelink/sl_fs_slfs.c" #endif /* Standard libc interface to TI SimpleLink FS. */ @@ -13580,7 +13630,7 @@ void fs_slfs_unset_file_flags(const char *name) { #endif /* defined(MG_FS_SLFS) || defined(CC3200_FS_SLFS) */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_fs.c" +#line 1 "src/common/platforms/simplelink/sl_fs.c" #endif #if MG_NET_IF == MG_NET_IF_SIMPLELINK && \ @@ -13990,7 +14040,7 @@ int sl_fs_init(void) { #endif /* MG_NET_IF == MG_NET_IF_SIMPLELINK && (defined(MG_FS_SLFS) || \ defined(MG_FS_SPIFFS)) */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_socket.c" +#line 1 "src/common/platforms/simplelink/sl_socket.c" #endif #if MG_NET_IF == MG_NET_IF_SIMPLELINK @@ -14037,7 +14087,7 @@ int inet_pton(int af, const char *src, void *dst) { #endif /* MG_NET_IF == MG_NET_IF_SIMPLELINK */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_mg_task.c" +#line 1 "src/common/platforms/simplelink/sl_mg_task.c" #endif #if MG_NET_IF == MG_NET_IF_SIMPLELINK && !defined(MG_SIMPLELINK_NO_OSI) @@ -14092,7 +14142,7 @@ void mg_run_in_task(void (*cb)(struct mg_mgr *mgr, void *arg), void *cb_arg) { #endif /* MG_NET_IF == MG_NET_IF_SIMPLELINK && !defined(MG_SIMPLELINK_NO_OSI) \ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_net_if.h" +#line 1 "src/common/platforms/simplelink/sl_net_if.h" #endif #ifndef CS_COMMON_PLATFORMS_SIMPLELINK_SL_NET_IF_H_ @@ -14116,7 +14166,7 @@ extern const struct mg_iface_vtable mg_simplelink_iface_vtable; #endif /* CS_COMMON_PLATFORMS_SIMPLELINK_SL_NET_IF_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_net_if.c" +#line 1 "src/common/platforms/simplelink/sl_net_if.c" #endif /* Amalgamated: #include "common/platforms/simplelink/sl_net_if.h" */ @@ -14535,7 +14585,7 @@ const struct mg_iface_vtable mg_default_iface_vtable = MG_SL_IFACE_VTABLE; #endif /* MG_ENABLE_NET_IF_SIMPLELINK */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/sl_ssl_if.c" +#line 1 "src/common/platforms/simplelink/sl_ssl_if.c" #endif #if MG_ENABLE_SSL && MG_SSL_IF == MG_SSL_IF_SIMPLELINK @@ -14773,7 +14823,7 @@ int sl_set_ssl_opts(int sock, struct mg_connection *nc) { #endif /* MG_ENABLE_SSL && MG_SSL_IF == MG_SSL_IF_SIMPLELINK */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/lwip/mg_lwip_net_if.h" +#line 1 "src/common/platforms/lwip/mg_lwip_net_if.h" #endif #ifndef CS_COMMON_PLATFORMS_LWIP_MG_NET_IF_LWIP_H_ @@ -14825,7 +14875,7 @@ void mg_lwip_mgr_schedule_poll(struct mg_mgr *mgr); #endif /* CS_COMMON_PLATFORMS_LWIP_MG_NET_IF_LWIP_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/lwip/mg_lwip_net_if.c" +#line 1 "src/common/platforms/lwip/mg_lwip_net_if.c" #endif #if MG_ENABLE_NET_IF_LWIP_LOW_LEVEL @@ -15558,7 +15608,7 @@ const struct mg_iface_vtable mg_default_iface_vtable = MG_LWIP_IFACE_VTABLE; #endif /* MG_ENABLE_NET_IF_LWIP_LOW_LEVEL */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/lwip/mg_lwip_ev_mgr.c" +#line 1 "src/common/platforms/lwip/mg_lwip_ev_mgr.c" #endif #if MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL @@ -15718,7 +15768,7 @@ time_t mg_lwip_if_poll(struct mg_iface *iface, int timeout_ms) { #endif /* MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/wince/wince_libc.c" +#line 1 "src/common/platforms/wince/wince_libc.c" #endif #ifdef WINCE @@ -15791,7 +15841,7 @@ static void mg_gmt_time_string(char *buf, size_t buf_len, time_t *t) { #endif #ifdef MG_MODULE_LINES -#line 1 "common/platforms/pic32/pic32_net_if.h" +#line 1 "src/common/platforms/pic32/pic32_net_if.h" #endif #ifndef CS_COMMON_PLATFORMS_PIC32_NET_IF_H_ @@ -15815,7 +15865,7 @@ extern const struct mg_iface_vtable mg_pic32_iface_vtable; #endif /* CS_COMMON_PLATFORMS_PIC32_NET_IF_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/pic32/pic32_net_if.c" +#line 1 "src/common/platforms/pic32/pic32_net_if.c" #endif #if MG_ENABLE_NET_IF_PIC32 @@ -16106,7 +16156,7 @@ const struct mg_iface_vtable mg_default_iface_vtable = MG_PIC32_IFACE_VTABLE; #endif /* MG_ENABLE_NET_IF_PIC32 */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/windows/windows_direct.c" +#line 1 "src/common/platforms/windows/windows_direct.c" #endif #ifdef _WIN32 diff --git a/vendor/mongoose.h b/vendor/mongoose.h index f768c8d..7808e91 100644 --- a/vendor/mongoose.h +++ b/vendor/mongoose.h @@ -18,12 +18,12 @@ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_common.h" +#line 1 "src/mg_common.h" #endif #ifndef CS_MONGOOSE_SRC_COMMON_H_ #define CS_MONGOOSE_SRC_COMMON_H_ -#define MG_VERSION "6.17" +#define MG_VERSION "6.18" /* Local tweaks, applied before any of Mongoose's own headers. */ #ifdef MG_LOCALS @@ -32,7 +32,7 @@ #endif /* CS_MONGOOSE_SRC_COMMON_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platform.h" +#line 1 "src/common/platform.h" #endif #ifndef CS_COMMON_PLATFORM_H_ #define CS_COMMON_PLATFORM_H_ @@ -174,7 +174,7 @@ #endif /* CS_COMMON_PLATFORM_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_windows.h" +#line 1 "src/common/platforms/platform_windows.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ #define CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ @@ -228,7 +228,7 @@ #include #include -#if _MSC_VER < 1700 +#if defined(_MSC_VER) && (_MSC_VER < 1700) typedef int bool; #else #include @@ -360,7 +360,7 @@ unsigned int sleep(unsigned int seconds); #endif /* CS_PLATFORM == CS_P_WINDOWS */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_unix.h" +#line 1 "src/common/platforms/platform_unix.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ #define CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ @@ -508,7 +508,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_UNIX */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_esp32.h" +#line 1 "src/common/platforms/platform_esp32.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_ESP32_H_ @@ -549,7 +549,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_ESP32 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_ESP32_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_esp8266.h" +#line 1 "src/common/platforms/platform_esp8266.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_ESP8266_H_ @@ -606,7 +606,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_ESP8266 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_ESP8266_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_cc3100.h" +#line 1 "src/common/platforms/platform_cc3100.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_CC3100_H_ @@ -651,7 +651,7 @@ int inet_pton(int af, const char *src, void *dst); #endif /* CS_PLATFORM == CS_P_CC3100 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_CC3100_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_cc3200.h" +#line 1 "src/common/platforms/platform_cc3200.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_CC3200_H_ @@ -772,7 +772,7 @@ int stat(const char *pathname, struct stat *st); #endif /* CS_PLATFORM == CS_P_CC3200 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_CC3200_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_cc3220.h" +#line 1 "src/common/platforms/platform_cc3220.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_CC3220_H_ @@ -880,7 +880,7 @@ int stat(const char *pathname, struct stat *st); #endif /* CS_PLATFORM == CS_P_CC3220 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_CC3200_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_msp432.h" +#line 1 "src/common/platforms/platform_msp432.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_MSP432_H_ @@ -984,7 +984,7 @@ int _stat(const char *pathname, struct stat *st); #endif /* CS_PLATFORM == CS_P_MSP432 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_MSP432_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_tm4c129.h" +#line 1 "src/common/platforms/platform_tm4c129.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_TM4C129_H_ @@ -1040,7 +1040,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_TM4C129 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_TM4C129_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_mbed.h" +#line 1 "src/common/platforms/platform_mbed.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_MBED_H_ @@ -1120,7 +1120,7 @@ in_addr_t inet_addr(const char *cp); #endif /* CS_PLATFORM == CS_P_MBED */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_MBED_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_nrf51.h" +#line 1 "src/common/platforms/platform_nrf51.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ #define CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ @@ -1161,7 +1161,7 @@ int gettimeofday(struct timeval *tp, void *tzp); #endif /* CS_PLATFORM == CS_P_NRF51 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_nrf52.h" +#line 1 "src/common/platforms/platform_nrf52.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ #define CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ @@ -1205,7 +1205,7 @@ int gettimeofday(struct timeval *tp, void *tzp); #endif /* CS_PLATFORM == CS_P_NRF52 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/simplelink/cs_simplelink.h" +#line 1 "src/common/platforms/simplelink/cs_simplelink.h" #endif #ifndef CS_COMMON_PLATFORMS_SIMPLELINK_CS_SIMPLELINK_H_ @@ -1368,7 +1368,7 @@ int slfs_open(const unsigned char *fname, uint32_t flags, uint32_t *token); #endif /* CS_COMMON_PLATFORMS_SIMPLELINK_CS_SIMPLELINK_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_wince.h" +#line 1 "src/common/platforms/platform_wince.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ #define CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ @@ -1572,7 +1572,7 @@ const char *strerror(); #endif /* CS_PLATFORM == CS_P_WINCE */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_nxp_lpc.h" +#line 1 "src/common/platforms/platform_nxp_lpc.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_ @@ -1624,7 +1624,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_NXP_LPC */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_nxp_kinetis.h" +#line 1 "src/common/platforms/platform_nxp_kinetis.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_NXP_KINETIS_H_ @@ -1654,7 +1654,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_NXP_KINETIS */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_NXP_KINETIS_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_pic32.h" +#line 1 "src/common/platforms/platform_pic32.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_PIC32_H_ @@ -1690,7 +1690,7 @@ char *inet_ntoa(struct in_addr in); #endif /* CS_COMMON_PLATFORMS_PLATFORM_PIC32_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_rs14100.h" +#line 1 "src/common/platforms/platform_rs14100.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ @@ -1738,7 +1738,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_RS14100 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_RS14100_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/platform_stm32.h" +#line 1 "src/common/platforms/platform_stm32.h" #endif #ifndef CS_COMMON_PLATFORMS_PLATFORM_STM32_H_ @@ -1776,7 +1776,7 @@ typedef struct stat cs_stat_t; #endif /* CS_PLATFORM == CS_P_STM32 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_STM32_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/platforms/lwip/mg_lwip.h" +#line 1 "src/common/platforms/lwip/mg_lwip.h" #endif #ifndef CS_COMMON_PLATFORMS_LWIP_MG_LWIP_H_ @@ -1843,7 +1843,7 @@ void mg_lwip_set_keepalive_params(struct mg_connection *nc, int idle, #endif /* CS_COMMON_PLATFORMS_LWIP_MG_LWIP_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/cs_md5.h" +#line 1 "src/common/cs_md5.h" #endif #ifndef CS_COMMON_MD5_H_ @@ -1875,7 +1875,7 @@ void cs_md5_final(unsigned char *md, cs_md5_ctx *c); #endif /* CS_COMMON_MD5_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/cs_sha1.h" +#line 1 "src/common/cs_sha1.h" #endif #ifndef CS_COMMON_SHA1_H_ @@ -1913,7 +1913,7 @@ void cs_hmac_sha1(const unsigned char *key, size_t key_len, #endif /* CS_COMMON_SHA1_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/cs_time.h" +#line 1 "src/common/cs_time.h" #endif #ifndef CS_COMMON_CS_TIME_H_ @@ -1942,7 +1942,7 @@ double cs_timegm(const struct tm *tm); #endif /* CS_COMMON_CS_TIME_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/mg_str.h" +#line 1 "src/common/mg_str.h" #endif #ifndef CS_COMMON_MG_STR_H_ @@ -2042,7 +2042,7 @@ int mg_str_starts_with(struct mg_str s, struct mg_str prefix); #endif /* CS_COMMON_MG_STR_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/mbuf.h" +#line 1 "src/common/mbuf.h" #endif /* @@ -2140,7 +2140,7 @@ void mbuf_trim(struct mbuf *); #endif /* CS_COMMON_MBUF_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/cs_base64.h" +#line 1 "src/common/cs_base64.h" #endif #ifndef CS_COMMON_CS_BASE64_H_ @@ -2193,7 +2193,7 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst, int *dec_len); #endif /* CS_COMMON_CS_BASE64_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/str_util.h" +#line 1 "src/common/str_util.h" #endif #ifndef CS_COMMON_STR_UTIL_H_ @@ -2378,7 +2378,7 @@ size_t mg_match_prefix_n(const struct mg_str pattern, const struct mg_str str); #endif /* CS_COMMON_STR_UTIL_H_ */ #ifdef MG_MODULE_LINES -#line 1 "common/queue.h" +#line 1 "src/common/queue.h" #endif /* clang-format off */ /*- @@ -3133,7 +3133,7 @@ struct { \ #endif /* !_SYS_QUEUE_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_features.h" +#line 1 "src/mg_features.h" #endif #ifndef CS_MONGOOSE_SRC_FEATURES_H_ @@ -3308,7 +3308,7 @@ struct { \ #endif /* CS_MONGOOSE_SRC_FEATURES_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net_if.h" +#line 1 "src/mg_net_if.h" #endif #ifndef CS_MONGOOSE_SRC_NET_IF_H_ @@ -3438,7 +3438,7 @@ double mg_mgr_min_timer(const struct mg_mgr *mgr); #endif /* CS_MONGOOSE_SRC_NET_IF_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_ssl_if.h" +#line 1 "src/mg_ssl_if.h" #endif #ifndef CS_MONGOOSE_SRC_SSL_IF_H_ @@ -3492,7 +3492,7 @@ int mg_ssl_if_write(struct mg_connection *nc, const void *data, size_t len); #endif /* CS_MONGOOSE_SRC_SSL_IF_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_net.h" +#line 1 "src/mg_net.h" #endif /* @@ -4078,7 +4078,7 @@ double mg_time(void); #endif /* CS_MONGOOSE_SRC_NET_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_uri.h" +#line 1 "src/mg_uri.h" #endif /* @@ -4144,7 +4144,7 @@ int mg_normalize_uri_path(const struct mg_str *in, struct mg_str *out); #endif /* __cplusplus */ #endif /* CS_MONGOOSE_SRC_URI_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_util.h" +#line 1 "src/mg_util.h" #endif /* @@ -4358,7 +4358,7 @@ struct mg_str mg_url_encode(const struct mg_str src); #endif /* __cplusplus */ #endif /* CS_MONGOOSE_SRC_UTIL_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http.h" +#line 1 "src/mg_http.h" #endif /* @@ -4420,8 +4420,16 @@ struct http_message { /* Headers */ struct mg_str header_names[MG_MAX_HTTP_HEADERS]; struct mg_str header_values[MG_MAX_HTTP_HEADERS]; + + /* + * Value of the Content-Length header if present, + * otherwise MG_HTTP_CONTENT_LENGTH_UNKNOWN. + */ + size_t content_length; }; +#define MG_HTTP_CONTENT_LENGTH_UNKNOWN ((size_t) -1) + #if MG_ENABLE_HTTP_WEBSOCKET /* WebSocket message */ struct websocket_message { @@ -4734,7 +4742,7 @@ void mg_http_send_digest_auth_request(struct mg_connection *c, #endif /* CS_MONGOOSE_SRC_HTTP_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http_server.h" +#line 1 "src/mg_http_server.h" #endif /* * === Server API reference @@ -5298,7 +5306,7 @@ void mg_http_reverse_proxy(struct mg_connection *nc, #endif /* CS_MONGOOSE_SRC_HTTP_SERVER_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_http_client.h" +#line 1 "src/mg_http_client.h" #endif /* * === Client API reference @@ -5363,7 +5371,7 @@ int mg_http_create_digest_auth_header(char *buf, size_t buf_len, #endif /* __cplusplus */ #endif /* CS_MONGOOSE_SRC_HTTP_CLIENT_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_mqtt.h" +#line 1 "src/mg_mqtt.h" #endif /* @@ -5578,7 +5586,7 @@ int mg_mqtt_vmatch_topic_expression(const char *exp, struct mg_str topic); #endif /* CS_MONGOOSE_SRC_MQTT_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_mqtt_server.h" +#line 1 "src/mg_mqtt_server.h" #endif /* @@ -5669,7 +5677,7 @@ struct mg_mqtt_session *mg_mqtt_next(struct mg_mqtt_broker *brk, #endif /* MG_ENABLE_MQTT_BROKER */ #endif /* CS_MONGOOSE_SRC_MQTT_BROKER_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_dns.h" +#line 1 "src/mg_dns.h" #endif /* @@ -5833,7 +5841,7 @@ void mg_set_protocol_dns(struct mg_connection *nc); #endif /* __cplusplus */ #endif /* CS_MONGOOSE_SRC_DNS_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_dns_server.h" +#line 1 "src/mg_dns_server.h" #endif /* @@ -5926,7 +5934,7 @@ void mg_dns_send_reply(struct mg_connection *nc, struct mg_dns_reply *r); #endif /* MG_ENABLE_DNS_SERVER */ #endif /* CS_MONGOOSE_SRC_DNS_SERVER_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_resolv.h" +#line 1 "src/mg_resolv.h" #endif /* @@ -6006,7 +6014,7 @@ int mg_resolve_from_hosts_file(const char *host, union socket_address *usa); #endif /* __cplusplus */ #endif /* CS_MONGOOSE_SRC_RESOLV_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_coap.h" +#line 1 "src/mg_coap.h" #endif /* @@ -6158,7 +6166,7 @@ uint32_t mg_coap_compose(struct mg_coap_message *cm, struct mbuf *io); #endif /* CS_MONGOOSE_SRC_COAP_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_sntp.h" +#line 1 "src/mg_sntp.h" #endif #ifndef CS_MONGOOSE_SRC_SNTP_H_ @@ -6211,7 +6219,7 @@ struct mg_connection *mg_sntp_get_time(struct mg_mgr *mgr, #endif /* CS_MONGOOSE_SRC_SNTP_H_ */ #ifdef MG_MODULE_LINES -#line 1 "mongoose/src/mg_socks.h" +#line 1 "src/mg_socks.h" #endif #ifndef CS_MONGOOSE_SRC_SOCKS_H_