mirror of
https://github.com/curl/curl.git
synced 2026-07-28 20:43:07 +03:00
Dominick Meglio implemented CURLOPT_MAXFILESIZE and --max-filesize.
This commit is contained in:
parent
94568f884d
commit
ce5db9a86e
11 changed files with 60 additions and 7 deletions
|
|
@ -578,6 +578,11 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||
/* check for Content-Length: header lines to get size */
|
||||
if (checkprefix("Content-Length:", k->p) &&
|
||||
sscanf (k->p+15, " %ld", &k->contentlength)) {
|
||||
if (data->set.max_filesize && k->contentlength >
|
||||
data->set.max_filesize) {
|
||||
failf(data, "Maximum file size exceeded");
|
||||
return CURLE_FILESIZE_EXCEEDED;
|
||||
}
|
||||
conn->size = k->contentlength;
|
||||
Curl_pgrsSetDownloadSize(data, k->contentlength);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue