]> git.ipfire.org Git - thirdparty/git.git/blobdiff - http-backend.c
http-backend: provide Allow header for 405
[thirdparty/git.git] / http-backend.c
index f50e77fb2890207bd7385b59bdd561133991c910..5102d974aafbdad003a083fe8c645c3a4955a7e0 100644 (file)
@@ -564,9 +564,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();