cgi: Support passing X-HTTP-Method-Override header.
authorKarl Palsson <karlp@remake.is>
Mon, 17 Aug 2015 15:19:48 +0000 (15:19 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 17 Aug 2015 16:16:52 +0000 (18:16 +0200)
As uhttpd doesn't currently support PUT/DELETE/PATCH, allow passing the
commonly used X-HTTP-Method-Override header to CGI scripts.

This is an optional "protocol specific metadata" variable as per rfc
3875 section 4.1.18.

Signed-off-by: Karl Palsson <karlp@remake.is>
proc.c

diff --git a/proc.c b/proc.c
index d4f5e3d..4819e08 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -33,7 +33,8 @@
        __header(referer, referer) \
        __header(user_agent, user-agent) \
        __header(content_type, content-type) \
-       __header(content_length, content-length)
+       __header(content_length, content-length) \
+       __header(x_http_method_override, x-http-method-override)
 
 #undef __header
 #define __header __enum_header
@@ -62,6 +63,7 @@ static const struct {
        { "HTTP_HOST", HDR_host },
        { "HTTP_REFERER", HDR_referer },
        { "HTTP_USER_AGENT", HDR_user_agent },
+       { "HTTP_X_HTTP_METHOD_OVERRIDE", HDR_x_http_method_override },
        { "CONTENT_TYPE", HDR_content_type },
        { "CONTENT_LENGTH", HDR_content_length },
 };