mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Perform endpoint auth check on multipart requests
https://github.com/cesanta/mongoose-os/issues/229#issuecomment-293613426 PUBLISHED_FROM=1c34db7ab2598eca1db0266cc6cdd31c32a16fff
This commit is contained in:
parent
b2e2ad9a45
commit
f9596cc1db
13
mongoose.c
13
mongoose.c
@ -5824,7 +5824,6 @@ static void mg_http_multipart_begin(struct mg_connection *nc,
|
||||
struct mg_http_proto_data *pd = mg_http_get_proto_data(nc);
|
||||
struct mg_str *ct;
|
||||
struct mbuf *io = &nc->recv_mbuf;
|
||||
void *user_data = nc->user_data;
|
||||
|
||||
char boundary[100];
|
||||
int boundary_len;
|
||||
@ -5871,13 +5870,9 @@ static void mg_http_multipart_begin(struct mg_connection *nc,
|
||||
ep = mg_http_get_endpoint_handler(nc->listener, &hm->uri);
|
||||
if (ep != NULL) {
|
||||
pd->endpoint_handler = ep->handler;
|
||||
#if MG_ENABLE_CALLBACK_USERDATA
|
||||
user_data = ep->user_data;
|
||||
#endif
|
||||
}
|
||||
|
||||
mg_call(nc, pd->endpoint_handler, user_data, MG_EV_HTTP_MULTIPART_REQUEST,
|
||||
hm);
|
||||
mg_http_call_endpoint_handler(nc, MG_EV_HTTP_MULTIPART_REQUEST, hm);
|
||||
|
||||
mbuf_remove(io, req_len);
|
||||
}
|
||||
@ -7944,7 +7939,11 @@ static void mg_http_call_endpoint_handler(struct mg_connection *nc, int ev,
|
||||
struct mg_http_proto_data *pd = mg_http_get_proto_data(nc);
|
||||
void *user_data = nc->user_data;
|
||||
|
||||
if (ev == MG_EV_HTTP_REQUEST) {
|
||||
if (ev == MG_EV_HTTP_REQUEST
|
||||
#if MG_ENABLE_HTTP_STREAMING_MULTIPART
|
||||
|| ev == MG_EV_HTTP_MULTIPART_REQUEST
|
||||
#endif
|
||||
) {
|
||||
struct mg_http_endpoint *ep =
|
||||
mg_http_get_endpoint_handler(nc->listener, &hm->uri);
|
||||
if (ep != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user