mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
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
This commit is contained in:
commit
26e53f8ac0
|
@ -594,9 +594,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (strcmp(method, c->method)) {
|
if (strcmp(method, c->method)) {
|
||||||
const char *proto = getenv("SERVER_PROTOCOL");
|
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");
|
http_status(405, "Method Not Allowed");
|
||||||
else
|
hdr_str("Allow", !strcmp(c->method, "GET") ?
|
||||||
|
"GET, HEAD" : c->method);
|
||||||
|
} else
|
||||||
http_status(400, "Bad Request");
|
http_status(400, "Bad Request");
|
||||||
hdr_nocache();
|
hdr_nocache();
|
||||||
end_headers();
|
end_headers();
|
||||||
|
|
Loading…
Reference in a new issue