summaryrefslogtreecommitdiffstats
path: root/http-backend.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-20 21:30:54 +0200
committerJunio C Hamano <gitster@pobox.com>2013-09-20 21:30:54 +0200
commit26e53f8ac02a5929e4b614010afaa9787f567698 (patch)
tree1b5b0955549433863cd88f68acf3599a60b42c57 /http-backend.c
parentMerge branch 'np/lookup-object-hashing' (diff)
parenthttp-backend: provide Allow header for 405 (diff)
downloadgit-26e53f8ac02a5929e4b614010afaa9787f567698.tar.xz
git-26e53f8ac02a5929e4b614010afaa9787f567698.zip
Merge branch 'bc/http-backend-allow-405'
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
Diffstat (limited to 'http-backend.c')
-rw-r--r--http-backend.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/http-backend.c b/http-backend.c
index 0324417297..8c464bd805 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -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();