cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Patch for CURLOPT_MAXFILESIZE

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 12 Oct 2003 16:18:25 +0200 (CEST)

On Sat, 11 Oct 2003, codemastr wrote:

> I think I got this working, though I'm wondering if I missed something
> seeing as how it seemed rather easy, and I would have thought someone would
> have already done this...

Based on a first quick glance on the patch, it sure looks like you've got
things right.

> Anyway, since it is for file size limiting, I figured that means it only
> makes sense for HTTP/FTP, so for HTTP it just checks the result of the
> Content-Length and stops if it is too large, and for FTP it checks the SIZE
> result.

Yeps, that's the only sensible way I can think of too. We should however
document that neither FTP nor HTTP always provide the size prior to the
download, so at times there will be files larger than the set maximum that are
downloaded anyway.

> I also added for curl a --max-filesize option to allow it to use this
> feature and it seems that it works perfectly (note though that I haven't
> tested through an HTTP proxy since I don't have access to any).

I can't think of any quirks a proxy might add to this case.

> Also, I didn't update the man pages or anything because I wasn't sure
> exactly how the curl helpfiles work since there seems to be some perl
> utilities to handle it so below is a brief description.

Information for next time: the .3 files are the source files for all the
man/help pages. They're written using NROFF format, which is a bit cryptic but
by seeing how the existing docs look you can easily figure out how to add new
similar sections or just edit existing ones. (Basicly, all files that are
present in CVS are "source files" that can be edited.)

The perl script is just responsible for putting together the huge help file
that makes --manual work for the command line tool. (It uses the texts from
the docs/curl.1 file and the docs/MANUAL files.)

> The attached patch was made against the current CVS version of curl.

It would totally rock if you could produce a few test cases for this new
option as well...

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
Received on 2003-10-12