mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
http: replace EVHTTP_REQ_UNKNOWN_ with 0
From the server perspective the evhttp_response_phrase_internal() should not be called with 0 before this patch, it will be called with EVHTTP_REQ_UNKNOWN_ hence this patch should not change behavior. Fixes: 68eb526d7b ("http: add WebDAV methods support") Fixes: #789 Fixes: #796 Reported-by: Thomas Bernard <miniupnp@free.fr>
This commit is contained in:
parent
55f9863b18
commit
799053db8a
@ -31,9 +31,6 @@ 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 */
|
||||
|
15
http.c
15
http.c
@ -1756,7 +1756,7 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
|
||||
const char *hostname;
|
||||
const char *scheme;
|
||||
size_t method_len;
|
||||
enum evhttp_cmd_type type;
|
||||
enum evhttp_cmd_type type = 0;
|
||||
|
||||
while (eos > line && *(eos-1) == ' ') {
|
||||
*(eos-1) = '\0';
|
||||
@ -1778,7 +1778,6 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
|
||||
version++;
|
||||
|
||||
method_len = (uri - method) - 1;
|
||||
type = EVHTTP_REQ_UNKNOWN_;
|
||||
|
||||
/* First line */
|
||||
switch (method_len) {
|
||||
@ -1941,13 +1940,13 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len)
|
||||
break;
|
||||
} /* switch */
|
||||
|
||||
if ((int)type == EVHTTP_REQ_UNKNOWN_) {
|
||||
event_debug(("%s: bad method %s on request %p from %s",
|
||||
if (!type) {
|
||||
event_debug(("%s: bad method %s on request %p from %s",
|
||||
__func__, method, req, req->remote_host));
|
||||
/* No error yet; we'll give a better error later when
|
||||
* we see that req->type is unsupported. */
|
||||
/* No error yet; we'll give a better error later when we see that
|
||||
* req->type is unsupported in evhttp_handle_request(). */
|
||||
}
|
||||
|
||||
|
||||
req->type = type;
|
||||
|
||||
if (evhttp_parse_http_version(version, req) < 0)
|
||||
@ -3602,7 +3601,7 @@ evhttp_handle_request(struct evhttp_request *req, void *arg)
|
||||
|
||||
bufferevent_disable(req->evcon->bufev, EV_READ);
|
||||
|
||||
if (req->type == 0 || req->uri == NULL) {
|
||||
if (req->uri == NULL) {
|
||||
evhttp_send_error(req, req->response_code, NULL);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user