]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #429: Also fix end of transfer for http download of auth zones.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 25 Mar 2021 11:18:49 +0000 (12:18 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 25 Mar 2021 11:18:49 +0000 (12:18 +0100)
doc/Changelog
util/netevent.c

index ce51687dc1941764b46ba1328c90941750e124ef..d5412a2a0bd11aa7f10cd0efaffa25043ce38a35 100644 (file)
@@ -1,3 +1,6 @@
+25 March 2021: Wouter
+       - Fix #429: Also fix end of transfer for http download of auth zones.
+
 24 March 2021: Wouter
        - Fix deprecation test to work for iOS TVOS and WatchOS, it uses
          CFLAGS and CPPFLAGS and also checks if the item is unavailable.
index aac717f8d64eafc929d329e786c6a594b00a5432..a5ea46229cf9ae98c47bf6b56a9500682dd17b77 100644 (file)
@@ -2401,7 +2401,7 @@ http_process_chunk_header(struct comm_point* c)
        return 1;
 }
 
-/** handle nonchunked data segment */
+/** handle nonchunked data segment, 0=fail, 1=wait */
 static int
 http_nonchunk_segment(struct comm_point* c)
 {
@@ -2410,7 +2410,7 @@ http_nonchunk_segment(struct comm_point* c)
         * we are looking to read tcp_byte_count more data
         * and then the transfer is done. */
        size_t remainbufferlen;
-       size_t got_now = sldns_buffer_limit(c->buffer) - c->http_stored;
+       size_t got_now = sldns_buffer_limit(c->buffer);
        if(c->tcp_byte_count <= got_now) {
                /* done, this is the last data fragment */
                c->http_stored = 0;
@@ -2419,7 +2419,6 @@ http_nonchunk_segment(struct comm_point* c)
                (void)(*c->callback)(c, c->cb_arg, NETEVENT_DONE, NULL);
                return 1;
        }
-       c->tcp_byte_count -= got_now;
        /* if we have the buffer space,
         * read more data collected into the buffer */
        remainbufferlen = sldns_buffer_capacity(c->buffer) -
@@ -2435,6 +2434,7 @@ http_nonchunk_segment(struct comm_point* c)
        }
        /* call callback with this data amount, then
         * wait for more */
+       c->tcp_byte_count -= got_now;
        c->http_stored = 0;
        sldns_buffer_set_position(c->buffer, 0);
        fptr_ok(fptr_whitelist_comm_point(c->callback));