From e1f7a6304440a4e777ef039bda729699a124171a Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 15 Sep 2015 23:28:59 +0200 Subject: [PATCH] adapt code to new libevent method extension --- miniupnpc-libevent/miniupnpc-libevent.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/miniupnpc-libevent/miniupnpc-libevent.c b/miniupnpc-libevent/miniupnpc-libevent.c index 88bd2b3..9c8df67 100644 --- a/miniupnpc-libevent/miniupnpc-libevent.c +++ b/miniupnpc-libevent/miniupnpc-libevent.c @@ -651,6 +651,14 @@ static int upnpc_send_soap_request(upnpc_device_t * p, const char * url, } #ifdef ENABLE_UPNP_EVENTS +#define EVHTTP_REQ_NOTIFY ((EVHTTP_REQ_MAX) << 1) +#define EVHTTP_REQ_SUBSCRIBE ((EVHTTP_REQ_NOTIFY) << 1) +static const struct evhttp_extended_methods ext_methods[] = { + {"NOTIFY", EVHTTP_REQ_NOTIFY, EVHTTP_METHOD_HAS_BODY}, + {"SUBSCRIBE", EVHTTP_REQ_SUBSCRIBE, EVHTTP_METHOD_HAS_BODY}, + {NULL, 0, 0} +}; + void upnpc_event_conn_req(struct evhttp_request * req, void * data) { size_t len; @@ -894,6 +902,7 @@ int upnpc_event_subscribe(upnpc_device_t * p) debug_printf("evhttp_new() FAILED\n"); return -1; } + evhttp_set_extended_methods(p->parent->http_server, ext_methods); evhttp_set_allowed_methods(p->parent->http_server, EVHTTP_REQ_NOTIFY); evhttp_set_cb(p->parent->http_server, "/evt_conn", upnpc_event_conn_req, p); if(evhttp_bind_socket(p->parent->http_server, p->parent->local_address, p->parent->local_port) < 0) { @@ -912,6 +921,7 @@ int upnpc_event_subscribe(upnpc_device_t * p) if(p->soap_conn == NULL) { p->soap_conn = evhttp_connection_base_new(p->parent->base, NULL, hostname, port); } + evhttp_connection_set_extended_methods(p->soap_conn, ext_methods); req = evhttp_request_new(upnpc_subscribe_response, p); headers = evhttp_request_get_output_headers(req); /*buffer = evhttp_request_get_output_buffer(req);*/