summaryrefslogtreecommitdiff
path: root/src/http_chunk.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-12-14 10:58:36 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2020-12-14 12:34:49 -0500
commit163cb8be2852aa922276eeba5259bcf8cea566b3 (patch)
tree8a491de15a37cd206557f7874671ed07415980b6 /src/http_chunk.c
parent4933a2259bc6e983843ce7a4ad92080448b60e93 (diff)
downloadlighttpd-git-163cb8be2852aa922276eeba5259bcf8cea566b3.tar.gz
[core] fix chunked decoding from backend (fixes #3044)
(thx flynn) x-ref: "Socket errors after update to version 1.4.56" https://redmine.lighttpd.net/issues/3044
Diffstat (limited to 'src/http_chunk.c')
-rw-r--r--src/http_chunk.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http_chunk.c b/src/http_chunk.c
index 28daaa3b..09f4d4a6 100644
--- a/src/http_chunk.c
+++ b/src/http_chunk.c
@@ -420,6 +420,7 @@ http_chunk_decode_append_data (request_st * const r, const char *mem, off_t len)
len -= hsz;
te_chunked += 2; /*(for trailing "\r\n" after chunked data)*/
+ if (0 == len) break;
}
if (te_chunked >= 2) {
@@ -437,7 +438,13 @@ http_chunk_decode_append_data (request_st * const r, const char *mem, off_t len)
len -= 2;
te_chunked = 0;
}
- else if (len == 1 && mem[0] != '\r') return -1;
+ else if (len == 1) {
+ if (mem[0] != '\r') return -1;
+ /*++mem;*/
+ /*--len;*/
+ te_chunked = 1;
+ break;
+ }
}
}
else if (1 == te_chunked) {