Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct.

This commit is contained in:
Nick Mathewson 2010-10-18 13:58:02 -04:00
parent e5870690fc
commit 49f4bf7c57
2 changed files with 9 additions and 2 deletions

7
http.c
View File

@ -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)
{

View File

@ -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 */