mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 12:28:19 -04:00
evhttp: Return 501 when we get an unrecognized method, not 400.
This commit is contained in:
parent
f5b391e22e
commit
536311a46b
@ -41,6 +41,9 @@ struct evbuffer;
|
|||||||
struct addrinfo;
|
struct addrinfo;
|
||||||
struct evhttp_request;
|
struct evhttp_request;
|
||||||
|
|
||||||
|
/* Indicates an unknown request method. */
|
||||||
|
#define _EVHTTP_REQ_UNKNOWN (1<<15)
|
||||||
|
|
||||||
enum evhttp_connection_state {
|
enum evhttp_connection_state {
|
||||||
EVCON_DISCONNECTED, /**< not currently connected not trying either*/
|
EVCON_DISCONNECTED, /**< not currently connected not trying either*/
|
||||||
EVCON_CONNECTING, /**< tries to currently connect */
|
EVCON_CONNECTING, /**< tries to currently connect */
|
||||||
|
4
http.c
4
http.c
@ -1398,9 +1398,11 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line)
|
|||||||
} else if (strcmp(method, "PATCH") == 0) {
|
} else if (strcmp(method, "PATCH") == 0) {
|
||||||
req->type = EVHTTP_REQ_PATCH;
|
req->type = EVHTTP_REQ_PATCH;
|
||||||
} else {
|
} else {
|
||||||
|
req->type = _EVHTTP_REQ_UNKNOWN;
|
||||||
event_debug(("%s: bad method %s on request %p from %s",
|
event_debug(("%s: bad method %s on request %p from %s",
|
||||||
__func__, method, req, req->remote_host));
|
__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) {
|
if (strcmp(version, "HTTP/1.0") == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user