From cb17c0d610f9c814c7ec8e63c9855b01a791dedb Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Thu, 27 Feb 2014 22:24:28 +0100 Subject: [PATCH] When returning a 405 append an Allow header as per rfc --- src/http.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/http.c b/src/http.c index 12b2112..309eeff 100644 --- 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