Re: Wrong http request size calculation when uploading /proc/cpuinfo
Date: Thu, 09 Aug 2012 23:13:13 +0200
On 09.08.2012 22:50, Daniel Stenberg wrote:
> On Thu, 9 Aug 2012, Florian Pritz wrote:
>> When using curl to upload files to a pastebin, I noticed that `curl -v -F
>> "file=@/proc/cpuinfo" http://...` will send an http request stating that the
>> file is empty, but it reads the contents anyway and the server (apache in my
>> case) returns "400 Bad Request" because it didn't expect the content.
>> I hope this is enough for someone with more knowledge about libcurl
>> internals to fix this properly.
> Sorry, but what exactly would a "proper" fix be to this problem you think?
So far I have only seen this happen for files read from some pseudo file
system like /proc and those tend to be small.
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.
-- Florian Pritz
- application/pgp-signature attachment: OpenPGP digital signature