Skip to content

Commit

Permalink
Merge branch 'bc/http-backend-allow-405' into maint
Browse files Browse the repository at this point in the history
* bc/http-backend-allow-405:
  http-backend: provide Allow header for 405
  • Loading branch information
Junio C Hamano committed Oct 17, 2013
2 parents da39d5e + 9247be0 commit 968792e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions http-backend.c
Original file line number Diff line number Diff line change
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 968792e

Please sign in to comment.