cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Wrong http request size calculation when uploading /proc/cpuinfo

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 9 Aug 2012 23:50:17 +0200

On Thu, Aug 09, 2012 at 11:13:13PM +0200, Florian Pritz wrote:
> So far I have only seen this happen for files read from some pseudo file
> system like /proc and those tend to be small.

The same thing would happen, for example, on block devices, pipes or
special character devices.

> I think you could load the file into ram and add a (configurable) upper
> limit. The default could be something like 50MiB. The user can increase
> as they see fit and 0 could mean "unlimited". If you hit the limit you
> throw an error.
>
> It won't be perfect, but at least the error will give users a clue about
> what's going on.

There some danger in doing that. If the user is trying to send data
directly from a pipe or a slow network socket or /dev/video, then it
could take a *long* time to reach 50 MiB at which time the program will
just exit without doing anything. Meanwhile, all that data is gone
forever.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-08-09