diff --git a/mongoose.c b/mongoose.c index f01f6386..62560616 100644 --- a/mongoose.c +++ b/mongoose.c @@ -5072,15 +5072,16 @@ void mg_http_handler(struct mg_connection *nc, int ev, void *ev_data) { */ struct mg_http_stream_info si; struct mg_http_multipart_part mp; + mg_event_handler_t handler; memset(&mp, 0, sizeof(mp)); mg_http_parse_stream_info(&pd->strm_state, &si); + handler = mg_http_get_endpoint_handler(nc->listener, &si.endpoint); mp.status = -1; mp.var_name = si.var_name.p; mp.file_name = si.file_name.p; - mg_call(nc, pd->endpoint_handler ? pd->endpoint_handler : nc->handler, - MG_EV_HTTP_PART_END, &mp); + mg_call(nc, (handler ? handler : nc->handler), MG_EV_HTTP_PART_END, &mp); } else #endif if (io->len > 0 && mg_parse_http(io->buf, io->len, hm, is_req) > 0) { diff --git a/mongoose.h b/mongoose.h index 0be5c4ba..a48e3738 100644 --- a/mongoose.h +++ b/mongoose.h @@ -134,8 +134,10 @@ #endif #include +#include #include #include +#include #include #include #include @@ -143,8 +145,6 @@ #include #include #include -#include -#include #define random() rand() #ifdef _MSC_VER @@ -839,7 +839,7 @@ const char *c_strnstr(const char *s, const char *find, size_t slen); !(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) && \ !(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L) && \ !defined(RTOS_SDK)) && \ - !(defined(_MSC_VER) && _MSC_VER >= 1600 /* MSVC2013+ has strnlen */) + !(defined(_MSC_VER) && _MSC_VER >= 1600 /* MSVC2010+ has strnlen */) #define _MG_PROVIDE_STRNLEN size_t strnlen(const char *s, size_t maxlen); #endif