version 1.208, 2021/11/10 07:32:55 |
version 1.209, 2022/09/08 11:12:44 |
|
|
|
|
/* Look for some headers */ |
/* Look for some headers */ |
cp = buf; |
cp = buf; |
#define CONTENTLEN "Content-Length: " |
#define CONTENTLEN "Content-Length:" |
if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) { |
if (strncasecmp(cp, CONTENTLEN, sizeof(CONTENTLEN) - 1) == 0) { |
size_t s; |
|
cp += sizeof(CONTENTLEN) - 1; |
cp += sizeof(CONTENTLEN) - 1; |
if ((s = strcspn(cp, " \t"))) |
cp += strspn(cp, " \t"); |
*(cp+s) = 0; |
cp[strcspn(cp, " \t")] = '\0'; |
filesize = strtonum(cp, 0, LLONG_MAX, &errstr); |
filesize = strtonum(cp, 0, LLONG_MAX, &errstr); |
if (errstr != NULL) |
if (errstr != NULL) |
goto improper; |
goto improper; |
|
|
if (restart_point) |
if (restart_point) |
filesize += restart_point; |
filesize += restart_point; |
#endif /* !SMALL */ |
#endif /* !SMALL */ |
#define LOCATION "Location: " |
#define LOCATION "Location:" |
} else if (isredirect && |
} else if (isredirect && |
strncasecmp(cp, LOCATION, sizeof(LOCATION) - 1) == 0) { |
strncasecmp(cp, LOCATION, sizeof(LOCATION) - 1) == 0) { |
cp += sizeof(LOCATION) - 1; |
cp += sizeof(LOCATION) - 1; |
|
cp += strspn(cp, " \t"); |
/* |
/* |
* If there is a colon before the first slash, this URI |
* If there is a colon before the first slash, this URI |
* is not relative. RFC 3986 4.2 |
* is not relative. RFC 3986 4.2 |
|
|
rval = url_get(redirurl, proxyenv, savefile, lastfile); |
rval = url_get(redirurl, proxyenv, savefile, lastfile); |
free(redirurl); |
free(redirurl); |
goto cleanup_url_get; |
goto cleanup_url_get; |
#define RETRYAFTER "Retry-After: " |
#define RETRYAFTER "Retry-After:" |
} else if (isunavail && |
} else if (isunavail && |
strncasecmp(cp, RETRYAFTER, sizeof(RETRYAFTER) - 1) == 0) { |
strncasecmp(cp, RETRYAFTER, sizeof(RETRYAFTER) - 1) == 0) { |
size_t s; |
size_t s; |
cp += sizeof(RETRYAFTER) - 1; |
cp += sizeof(RETRYAFTER) - 1; |
if ((s = strcspn(cp, " \t"))) |
cp += strspn(cp, " \t"); |
cp[s] = '\0'; |
cp[strcspn(cp, " \t")] = '\0'; |
retryafter = strtonum(cp, 0, 0, &errstr); |
retryafter = strtonum(cp, 0, 0, &errstr); |
if (errstr != NULL) |
if (errstr != NULL) |
retryafter = -1; |
retryafter = -1; |
#define TRANSFER_ENCODING "Transfer-Encoding: " |
#define TRANSFER_ENCODING "Transfer-Encoding:" |
} else if (strncasecmp(cp, TRANSFER_ENCODING, |
} else if (strncasecmp(cp, TRANSFER_ENCODING, |
sizeof(TRANSFER_ENCODING) - 1) == 0) { |
sizeof(TRANSFER_ENCODING) - 1) == 0) { |
cp += sizeof(TRANSFER_ENCODING) - 1; |
cp += sizeof(TRANSFER_ENCODING) - 1; |
|
cp += strspn(cp, " \t"); |
cp[strcspn(cp, " \t")] = '\0'; |
cp[strcspn(cp, " \t")] = '\0'; |
if (strcasecmp(cp, "chunked") == 0) |
if (strcasecmp(cp, "chunked") == 0) |
chunked = 1; |
chunked = 1; |
#ifndef SMALL |
#ifndef SMALL |
#define LAST_MODIFIED "Last-Modified: " |
#define LAST_MODIFIED "Last-Modified:" |
} else if (strncasecmp(cp, LAST_MODIFIED, |
} else if (strncasecmp(cp, LAST_MODIFIED, |
sizeof(LAST_MODIFIED) - 1) == 0) { |
sizeof(LAST_MODIFIED) - 1) == 0) { |
cp += sizeof(LAST_MODIFIED) - 1; |
cp += sizeof(LAST_MODIFIED) - 1; |