Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
httpc: fix the EOC test in http_client_data_chunked()
  • Loading branch information
perexg committed Nov 28, 2014
1 parent ea7c5b5 commit cf82786
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/httpc.c
Expand Up @@ -740,7 +740,7 @@ http_client_data_chunked( http_client_t *hc, char *buf, size_t len, int *end )
}
l = 0;
if (hc->hc_chunk_csize) {
s = d = hc->hc_chunk;
s = hc->hc_chunk;
if (buf[0] == '\n' && s[hc->hc_chunk_csize-1] == '\r')
l = 1;
else if (len > 1 && buf[0] == '\r' && buf[1] == '\n')
Expand All @@ -766,7 +766,10 @@ http_client_data_chunked( http_client_t *hc, char *buf, size_t len, int *end )
return res;
continue;
}
if (s[0] == '0' && s[1] == '\0')
d = s + 1;
while (*d == '0' && *d)
d++;
if (s[0] == '0' && *d == '\0')
hc->hc_chunk_trails = 1;
else {
hc->hc_chunk_size = strtoll(s, NULL, 16);
Expand Down

0 comments on commit cf82786

Please sign in to comment.