commit cb17c0d610f9c814c7ec8e63c9855b01a791dedb
parent 634bb482d6be3c7559484ddf7545c30b5916afe6
Author: Joris Vink <joris@coders.se>
Date: Thu, 27 Feb 2014 22:24:28 +0100
When returning a 405 append an Allow header as per rfc
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/http.c b/src/http.c
@@ -919,6 +919,9 @@ http_response_spdy(struct http_request *req, struct connection *c,
KORE_VERSION_STATE);
spdy_header_block_add(hblock, ":server", sbuf);
+ if (status == HTTP_STATUS_METHOD_NOT_ALLOWED)
+ spdy_header_block_add(hblock, ":allow", "get, post");
+
if (http_hsts_enable) {
snprintf(sbuf, sizeof(sbuf),
"max-age=%" PRIu64, http_hsts_enable);
@@ -969,6 +972,9 @@ http_response_normal(struct http_request *req, struct connection *c,
KORE_NAME_STRING, KORE_VERSION_MAJOR, KORE_VERSION_MINOR,
KORE_VERSION_STATE);
+ if (status == HTTP_STATUS_METHOD_NOT_ALLOWED)
+ kore_buf_appendf(buf, "Allow: GET, POST\r\n");
+
if (c->flags & CONN_CLOSE_EMPTY)
connection_close = 1;
else