From 4d7f5737f150c4bab8d3832bab9da62eddfea7d2 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Fri, 16 Dec 2016 11:06:29 -0500 Subject: [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 --- src/mod_proxy.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mod_proxy.c') 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); + } } } -- cgit v1.2.1