version 1.203, 2013/11/02 19:55:47 |
version 1.204, 2013/11/03 14:45:50 |
Line 1203 fetch_url(const char *url, const char *p |
|
Line 1203 fetch_url(const char *url, const char *p |
|
|
|
bytes = 0; |
bytes = 0; |
hashbytes = mark; |
hashbytes = mark; |
|
if (oldalrm) { |
|
(void)xsignal(SIGALRM, oldalrm); |
|
oldalrm = NULL; |
|
} |
progressmeter(-1); |
progressmeter(-1); |
|
|
/* Finally, suck down the file. */ |
/* Finally, suck down the file. */ |
Line 1214 fetch_url(const char *url, const char *p |
|
Line 1218 fetch_url(const char *url, const char *p |
|
lastchunk = 0; |
lastchunk = 0; |
/* read chunk-size */ |
/* read chunk-size */ |
if (ischunked) { |
if (ischunked) { |
alarmtimer(quit_time ? quit_time : 60); |
|
if (fetch_getln(xferbuf, bufsize, fin) == NULL) { |
if (fetch_getln(xferbuf, bufsize, fin) == NULL) { |
warnx("Unexpected EOF reading chunk-size"); |
warnx("Unexpected EOF reading chunk-size"); |
goto cleanup_fetch_url; |
goto cleanup_fetch_url; |
} |
} |
alarmtimer(0); |
|
errno = 0; |
errno = 0; |
chunksize = strtol(xferbuf, &ep, 16); |
chunksize = strtol(xferbuf, &ep, 16); |
if (ep == xferbuf) { |
if (ep == xferbuf) { |
Line 1269 fetch_url(const char *url, const char *p |
|
Line 1271 fetch_url(const char *url, const char *p |
|
if (ischunked) |
if (ischunked) |
bufrem = MIN(chunksize, bufrem); |
bufrem = MIN(chunksize, bufrem); |
while (bufrem > 0) { |
while (bufrem > 0) { |
alarmtimer(quit_time ? quit_time : 60); |
|
flen = fetch_read(xferbuf, sizeof(char), |
flen = fetch_read(xferbuf, sizeof(char), |
MIN((off_t)bufsize, bufrem), fin); |
MIN((off_t)bufsize, bufrem), fin); |
alarmtimer(0); |
|
if (flen <= 0) |
if (flen <= 0) |
goto chunkdone; |
goto chunkdone; |
bytes += flen; |
bytes += flen; |
Line 1310 fetch_url(const char *url, const char *p |
|
Line 1310 fetch_url(const char *url, const char *p |
|
/* read CRLF after chunk*/ |
/* read CRLF after chunk*/ |
chunkdone: |
chunkdone: |
if (ischunked) { |
if (ischunked) { |
alarmtimer(quit_time ? quit_time : 60); |
|
if (fetch_getln(xferbuf, bufsize, fin) == NULL) { |
if (fetch_getln(xferbuf, bufsize, fin) == NULL) { |
alarmtimer(0); |
alarmtimer(0); |
warnx("Unexpected EOF reading chunk CRLF"); |
warnx("Unexpected EOF reading chunk CRLF"); |
goto cleanup_fetch_url; |
goto cleanup_fetch_url; |
} |
} |
alarmtimer(0); |
|
if (strcmp(xferbuf, "\r\n") != 0) { |
if (strcmp(xferbuf, "\r\n") != 0) { |
warnx("Unexpected data following chunk"); |
warnx("Unexpected data following chunk"); |
goto cleanup_fetch_url; |
goto cleanup_fetch_url; |