summaryrefslogtreecommitdiff
path: root/src/mod_setenv.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2018-11-15 03:35:55 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2018-11-17 01:24:26 -0500
commitf13db69012304f4d8145f14730ea0d1425006c31 (patch)
tree2e07f3646595b3801a3dc7548103a843288205df /src/mod_setenv.c
parent41b50cfa713dbb037e29cbc1dc27680e9df017b1 (diff)
downloadlighttpd-git-f13db69012304f4d8145f14730ea0d1425006c31.tar.gz
[core] fix setting of headers previously reset (fixes #2919)
bug may result in long delays when using mod_deflate on connections with keep-alive, as the result is sent without Content-Length or Transfer-Encoding (regression in lighttpd 1.4.51) (thx GilGalaad) x-ref: "high latency on 1.4.51 + proxy + deflate" https://redmine.lighttpd.net/boards/2/topics/8365 https://redmine.lighttpd.net/issues/2919
Diffstat (limited to 'src/mod_setenv.c')
-rw-r--r--src/mod_setenv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mod_setenv.c b/src/mod_setenv.c
index ba8627b9..43eb7abe 100644
--- a/src/mod_setenv.c
+++ b/src/mod_setenv.c
@@ -227,7 +227,9 @@ URIHANDLER_FUNC(mod_setenv_uri_handler) {
for (k = 0; k < hctx->conf.set_request_header->used; ++k) {
data_string *ds = (data_string *)hctx->conf.set_request_header->data[k];
enum http_header_e id = http_header_hkey_get(CONST_BUF_LEN(ds->key));
- http_header_request_set(con, id, CONST_BUF_LEN(ds->key), CONST_BUF_LEN(ds->value));
+ !buffer_string_is_empty(ds->value)
+ ? http_header_request_set(con, id, CONST_BUF_LEN(ds->key), CONST_BUF_LEN(ds->value))
+ : http_header_request_unset(con, id, CONST_BUF_LEN(ds->key));
}
return HANDLER_GO_ON;
@@ -269,7 +271,9 @@ CONNECTION_FUNC(mod_setenv_handle_response_start) {
for (size_t k = 0; k < hctx->conf.set_response_header->used; ++k) {
data_string *ds = (data_string *)hctx->conf.set_response_header->data[k];
enum http_header_e id = http_header_hkey_get(CONST_BUF_LEN(ds->key));
- http_header_response_set(con, id, CONST_BUF_LEN(ds->key), CONST_BUF_LEN(ds->value));
+ !buffer_string_is_empty(ds->value)
+ ? http_header_response_set(con, id, CONST_BUF_LEN(ds->key), CONST_BUF_LEN(ds->value))
+ : http_header_response_unset(con, id, CONST_BUF_LEN(ds->key));
}
return HANDLER_GO_ON;