From 49f4bf7c577790fad711324250ed571a0aceac8b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 18 Oct 2010 13:58:02 -0400 Subject: [PATCH] Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct. --- http.c | 7 ++++++- include/event2/http.h | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) 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 */ -- 2.40.0