Commit bf7dd7ac authored by Dmitry Frank's avatar Dmitry Frank Committed by Cesanta Bot

Add separate userdata for each http endpoint hdlr

PUBLISHED_FROM=29a204c2c7f35724b6f1e8435edb94869da2362c
parent 0fc33708
...@@ -4,7 +4,8 @@ decl_name: "mg_register_http_endpoint" ...@@ -4,7 +4,8 @@ decl_name: "mg_register_http_endpoint"
symbol_kind: "func" symbol_kind: "func"
signature: | signature: |
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path, void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
mg_event_handler_t handler); MG_CB(mg_event_handler_t handler,
void *user_data);
--- ---
Registers a callback for a specified http endpoint Registers a callback for a specified http endpoint
......
...@@ -98,7 +98,7 @@ int main(void) { ...@@ -98,7 +98,7 @@ int main(void) {
mg_mgr_init(&mgr, NULL); mg_mgr_init(&mgr, NULL);
nc = mg_bind(&mgr, s_http_port, ev_handler); nc = mg_bind(&mgr, s_http_port, ev_handler);
mg_register_http_endpoint(nc, "/upload", handle_upload); mg_register_http_endpoint(nc, "/upload", handle_upload MG_UD_ARG(NULL));
// Set up HTTP server parameters // Set up HTTP server parameters
mg_set_protocol_http_websocket(nc); mg_set_protocol_http_websocket(nc);
......
This diff is collapsed.
...@@ -4792,7 +4792,8 @@ void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data, ...@@ -4792,7 +4792,8 @@ void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
* ``` * ```
*/ */
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path, void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path,
mg_event_handler_t handler); MG_CB(mg_event_handler_t handler,
void *user_data));
/* /*
* Authenticates a HTTP request against an opened password file. * Authenticates a HTTP request against an opened password file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment