fix received content-length counting for binary data - hurl - Gopher/HTTP/HTTPS file grabber
 (HTM) git clone git://git.codemadness.org/hurl
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 266933a3410be837c5dbd4a03b5a618acc0199b4
 (DIR) parent 59def2c4c0c35c5a6fd38fe209343232f510d903
 (HTM) 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:
         M hurl.c                              |       4 ++--
       
       1 file changed, 2 insertions(+), 2 deletions(-)
       ---
 (DIR) 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);