| 747 | }; |
| 748 | |
| 749 | static int bad_request(struct strbuf *hdr, const struct service_cmd *c) |
| 750 | { |
| 751 | const char *proto = getenv("SERVER_PROTOCOL"); |
| 752 | |
| 753 | if (proto && !strcmp(proto, "HTTP/1.1")) { |
| 754 | http_status(hdr, 405, "Method Not Allowed"); |
| 755 | hdr_str(hdr, "Allow", |
| 756 | !strcmp(c->method, "GET") ? "GET, HEAD" : c->method); |
| 757 | } else |
| 758 | http_status(hdr, 400, "Bad Request"); |
| 759 | hdr_nocache(hdr); |
| 760 | end_headers(hdr); |
| 761 | return 0; |
| 762 | } |
| 763 | |
| 764 | int cmd_main(int argc UNUSED, const char **argv UNUSED) |
| 765 | { |
no test coverage detected