From ff0c5f863d02c29a0eb11f0130110b390656b558 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 25 Mar 2021 12:18:49 +0100 Subject: [PATCH] - Fix #429: Also fix end of transfer for http download of auth zones. --- doc/Changelog | 3 +++ util/netevent.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index ce51687dc..d5412a2a0 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/util/netevent.c b/util/netevent.c index aac717f8d..a5ea46229 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -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)); -- 2.47.2