From: Nick Mathewson Date: Mon, 18 Oct 2010 17:58:02 +0000 (-0400) Subject: Add evhttp_request_get_command so code can tell GET from POST without peeking at... X-Git-Tag: release-2.0.9-rc~67^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49f4bf7c577790fad711324250ed571a0aceac8b;p=libevent Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct. --- diff --git a/http.c b/http.c index 03d67127..6aca33c3 100644 --- a/http.c +++ b/http.c @@ -3058,12 +3058,17 @@ evhttp_request_set_chunked_cb(struct evhttp_request *req, */ const char * -evhttp_request_get_uri(struct evhttp_request *req) { +evhttp_request_get_uri(const struct evhttp_request *req) { if (req->uri == NULL) event_debug(("%s: request %p has no uri\n", __func__, req)); return (req->uri); } +enum evhttp_cmd_type +evhttp_request_get_command(const struct evhttp_request *req) { + return (req->type); +} + /** Returns the input headers */ struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req) { diff --git a/include/event2/http.h b/include/event2/http.h index 3f84cfa5..d872a189 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -450,7 +450,9 @@ void evhttp_cancel_request(struct evhttp_request *req); /** Returns the request URI */ -const char *evhttp_request_get_uri(struct evhttp_request *req); +const char *evhttp_request_get_uri(const struct evhttp_request *req); +/** Returns the request command */ +enum evhttp_cmd_type evhttp_request_get_command(const struct evhttp_request *req); /** Returns the input headers */ struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req); /** Returns the output headers */