Skip to content

Commit 26e53f8

Browse files
committed
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
2 parents 3fb9d68 + 9247be0 commit 26e53f8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

http-backend.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,11 @@ int main(int argc, char **argv)
594594

595595
if (strcmp(method, c->method)) {
596596
const char *proto = getenv("SERVER_PROTOCOL");
597-
if (proto && !strcmp(proto, "HTTP/1.1"))
597+
if (proto && !strcmp(proto, "HTTP/1.1")) {
598598
http_status(405, "Method Not Allowed");
599-
else
599+
hdr_str("Allow", !strcmp(c->method, "GET") ?
600+
"GET, HEAD" : c->method);
601+
} else
600602
http_status(400, "Bad Request");
601603
hdr_nocache();
602604
end_headers();

0 commit comments

Comments
 (0)