- Fix #429: Also fix end of transfer for http download of auth zones.

This commit is contained in:
W.C.A. Wijngaards 2021-03-25 12:18:49 +01:00
parent f3dcb297d9
commit ff0c5f863d
2 changed files with 6 additions and 3 deletions

View 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 24 March 2021: Wouter
- Fix deprecation test to work for iOS TVOS and WatchOS, it uses - Fix deprecation test to work for iOS TVOS and WatchOS, it uses
CFLAGS and CPPFLAGS and also checks if the item is unavailable. CFLAGS and CPPFLAGS and also checks if the item is unavailable.

View file

@ -2401,7 +2401,7 @@ http_process_chunk_header(struct comm_point* c)
return 1; return 1;
} }
/** handle nonchunked data segment */ /** handle nonchunked data segment, 0=fail, 1=wait */
static int static int
http_nonchunk_segment(struct comm_point* c) 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 * we are looking to read tcp_byte_count more data
* and then the transfer is done. */ * and then the transfer is done. */
size_t remainbufferlen; 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) { if(c->tcp_byte_count <= got_now) {
/* done, this is the last data fragment */ /* done, this is the last data fragment */
c->http_stored = 0; 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); (void)(*c->callback)(c, c->cb_arg, NETEVENT_DONE, NULL);
return 1; return 1;
} }
c->tcp_byte_count -= got_now;
/* if we have the buffer space, /* if we have the buffer space,
* read more data collected into the buffer */ * read more data collected into the buffer */
remainbufferlen = sldns_buffer_capacity(c->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 /* call callback with this data amount, then
* wait for more */ * wait for more */
c->tcp_byte_count -= got_now;
c->http_stored = 0; c->http_stored = 0;
sldns_buffer_set_position(c->buffer, 0); sldns_buffer_set_position(c->buffer, 0);
fptr_ok(fptr_whitelist_comm_point(c->callback)); fptr_ok(fptr_whitelist_comm_point(c->callback));