commit 266933a3410be837c5dbd4a03b5a618acc0199b4
parent 59def2c4c0c35c5a6fd38fe209343232f510d903
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 11 Aug 2021 12:14:46 +0200
fix received content-length counting for binary data
Reported by adc, thanks!
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hurl.c b/hurl.c
@@ -336,7 +336,7 @@ https_request(void)
*p = '\0'; /* NUL terminate header part */
cs = parse_content_length(buf, &expectedlen);
p += strlen("\r\n\r\n");
- bodylen = strlen(p); /* (partial) body after header */
+ bodylen = len - (p - buf); /* (partial) body after header */
if (httpok) {
n = len - (p - buf);
@@ -462,7 +462,7 @@ http_request(void)
*p = '\0'; /* NUL terminate header part */
cs = parse_content_length(buf, &expectedlen);
p += strlen("\r\n\r\n");
- bodylen = strlen(p); /* (partial) body after header */
+ bodylen = len - (p - buf); /* (partial) body after header */
if (httpok) {
n = len - (p - buf);