summaryrefslogtreecommitdiff
path: root/src/mod_proxy.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2016-12-16 11:06:29 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2016-12-16 16:58:04 -0500
commit4d7f5737f150c4bab8d3832bab9da62eddfea7d2 (patch)
tree3f5e56edf1e30f1a8da842e28ca283f196e8560b /src/mod_proxy.c
parentf792d84cf9d16e8089aef7206b4a60d31c11ad55 (diff)
downloadlighttpd-git-4d7f5737f150c4bab8d3832bab9da62eddfea7d2.tar.gz
[core] support Transfer-Encoding: chunked req body (fixes #2156)
support Transfer-Encoding: chunked request body in conjunction with server.stream-request-body = 0 dynamic handlers will still return 411 Length Required if server.stream-request-body = 1 or 2 (!= 0) since CGI-like env requires CONTENT_LENGTH be set (and mod_proxy currently sends HTTP/1.0 requests to backends, and Content-Length recommended for robust interaction with backend) x-ref: "request: support Chunked Transfer Coding for HTTP PUT" https://redmine.lighttpd.net/issues/2156
Diffstat (limited to 'src/mod_proxy.c')
-rw-r--r--src/mod_proxy.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mod_proxy.c b/src/mod_proxy.c
index a916fae6..2881efce 100644
--- a/src/mod_proxy.c
+++ b/src/mod_proxy.c
@@ -1169,6 +1169,15 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequest) {
}
}
if (r != HANDLER_GO_ON) return r;
+
+ /* mod_proxy sends HTTP/1.0 request and ideally should send
+ * Content-Length with request if request body is present, so
+ * send 411 Length Required if Content-Length missing.
+ * (occurs here if client sends Transfer-Encoding: chunked
+ * and module is flagged to stream request body to backend) */
+ if (-1 == con->request.content_length) {
+ return connection_handle_read_post_error(srv, con, 411);
+ }
}
}