cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: aborting a transaction

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 29 Sep 2009 23:50:13 +0200 (CEST)

On Mon, 28 Sep 2009, johansen_at_sun.com wrote:

(I dropped the curl-and-python list from the CC for now)

> I had a related question about CURLOPT_MAXFILESIZE.
>
> The documentation currently says that, "The file size is not always
> known prior to download, and for such files this option has no effect
> even if the file transfer ends up being larger than this given limit."
>
> I understand that we may not always know the download size ahead of time,
> but in many cases libcurl consumers are using the default write function,
> and haven't installed their own by settin CURLOPT_WRITEFUNCTION. In the
> case where the default write function is used and MAXFILESIZE is set, would
> it be reasonable to have the writefunction check if the maximum file size
> has been exceeded and return CURLE_FILESIZE_EXCEEDED if so. This would mean
> that most callers get the check by default, making their implementations
> more secure. I would expect anyone writing their own WRITEFUNCTION to need
> to check this error condition on their own.

I wouldn't be entirely against such an option, but I don't think
CURLOPT_MAXFILESIZE is that option.

The name of it may imply such a functionality, but in my mind there's a
difference in that it actually only checks the size to decide if there should
be a download at all. So if you set the max to 20K and the file size is found
out to be 22K there will be no download.

If we'd have an option for "max amount of data to download" it would then
download 20K first before it stops. Not the same thing.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-09-29