Skip to content

Commit

Permalink
Merge branch 'bc/http-backend-allow-405'
Browse files Browse the repository at this point in the history
When the webserver responds with "405 Method Not Allowed", it
should tell the client what methods are allowed with the "Allow"
header.

* bc/http-backend-allow-405:
  http-backend: provide Allow header for 405
  • Loading branch information
gitster committed Sep 20, 2013
2 parents 3fb9d68 + 9247be0 commit 26e53f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions http-backend.c
Expand Up @@ -594,9 +594,11 @@ int main(int argc, char **argv)

if (strcmp(method, c->method)) {
const char *proto = getenv("SERVER_PROTOCOL");
if (proto && !strcmp(proto, "HTTP/1.1"))
if (proto && !strcmp(proto, "HTTP/1.1")) {
http_status(405, "Method Not Allowed");
else
hdr_str("Allow", !strcmp(c->method, "GET") ?
"GET, HEAD" : c->method);
} else
http_status(400, "Bad Request");
hdr_nocache();
end_headers();
Expand Down

0 comments on commit 26e53f8

Please sign in to comment.