Forum Moderators: coopster
I'm looking to limit the size of downloaded files to 100 kilobytes.
A quick look at the curl.exe flag options brings this option:
-r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server
Which I suppose could be used, but isn't supported by all servers.
Is there an option to limit the size of the download, or some kind of work around?
Cheers
// There's also mentionings of "CURLOPT_MAXFILESIZE" on some forum pages but it doesn't seem to be a valid option (at least with my version of php/curl)
I had a read of how it works, it seems to depend on the existence of a Content-Length header in the HTTP response, which isn't always there.
CURLOPT_RANGE
"Range(s) of data to retrieve in the format "X-Y" where X or Y are optional. HTTP transfers also support several intervals, separated with commas in the format "X-Y,N-M"."
I might try this...I may be wrong but this could also be dependent on the server, if I remember right some servers do not accept byte range requests. I'll just have to toy around with it and see what works.
Any request made to this CURL function of mine has seven seconds to get fetched, so hopefully someone can't user submit a 2 gig file "for the fun of it" :)
The ideal scenario is to limit fetches to 100KB
Cheers