evhttp: Return 501 when we get an unrecognized method, not 400.

This commit is contained in:
Nick Mathewson 2010-11-04 12:39:41 -04:00
parent f5b391e22e
commit 536311a46b
2 changed files with 6 additions and 1 deletions

View File

@ -41,6 +41,9 @@ struct evbuffer;
struct addrinfo;
struct evhttp_request;
/* Indicates an unknown request method. */
#define _EVHTTP_REQ_UNKNOWN (1<<15)
enum evhttp_connection_state {
EVCON_DISCONNECTED, /**< not currently connected not trying either*/
EVCON_CONNECTING, /**< tries to currently connect */

4
http.c
View File

@ -1398,9 +1398,11 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line)
} else if (strcmp(method, "PATCH") == 0) {
req->type = EVHTTP_REQ_PATCH;
} else {
req->type = _EVHTTP_REQ_UNKNOWN;
event_debug(("%s: bad method %s on request %p from %s",
__func__, method, req, req->remote_host));
return (-1);
/* No error yet; we'll give a better error later when
* we see that req->type is unsupported. */
}
if (strcmp(version, "HTTP/1.0") == 0) {