diff --git a/NEWS b/NEWS index caefa295..5908e92e 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ NEWS * [mod_auth] fix invalid read in digest qop=auth-int handling (fixes #2478) * [auto* build] simplify autogen.sh, handle automake 1.13 test running (fixes #2490) * [mod_userdir] add userdir.active option, "enabled" by default + * [core] return 501 Not Implemented in static file mode for all methods except GET/POST/HEAD/OPTIONS - 1.4.32 - 2012-11-21 * Code cleanup with clang/sparse (fixes #2437, thx kibi) diff --git a/src/connections.c b/src/connections.c index 77714c9f..b653e882 100644 --- a/src/connections.c +++ b/src/connections.c @@ -419,16 +419,6 @@ static int connection_handle_write_prepare(server *srv, connection *con) { case HTTP_METHOD_GET: case HTTP_METHOD_POST: case HTTP_METHOD_HEAD: - case HTTP_METHOD_PUT: - case HTTP_METHOD_PATCH: - case HTTP_METHOD_MKCOL: - case HTTP_METHOD_DELETE: - case HTTP_METHOD_COPY: - case HTTP_METHOD_MOVE: - case HTTP_METHOD_PROPFIND: - case HTTP_METHOD_PROPPATCH: - case HTTP_METHOD_LOCK: - case HTTP_METHOD_UNLOCK: break; case HTTP_METHOD_OPTIONS: /* @@ -450,16 +440,8 @@ static int connection_handle_write_prepare(server *srv, connection *con) { } break; default: - switch(con->http_status) { - case 400: /* bad request */ - case 401: /* authorization required */ - case 414: /* overload request header */ - case 505: /* unknown protocol */ - case 207: /* this was webdav */ - break; - default: + if (0 == con->http_status) { con->http_status = 501; - break; } break; } diff --git a/src/request.c b/src/request.c index c5e26ec1..6bdaf578 100644 --- a/src/request.c +++ b/src/request.c @@ -366,7 +366,7 @@ int http_request_parse(server *srv, connection *con) { *(proto - 1) = '\0'; /* we got the first one :) */ - if (-1 == (r = get_http_method_key(method))) { + if (HTTP_METHOD_UNSET == (r = get_http_method_key(method))) { con->http_status = 501; con->response.keep_alive = 0; con->keep_alive = 0;