[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] When exactly POST data won't be passed as upload_dat
Re: [libmicrohttpd] When exactly POST data won't be passed as upload_data?
Sun, 11 Jan 2015 01:57:55 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0
Oops: The documentation is wrong in this point, we (for a long time now,
like MHD 0.4 or earlier even) always pass the POST upload data
"incrementally" regardless of how big or smalll it is via "upload_data"
(one issue is that with the documented method is that it is ambiguous
and thus developers can't write simple code that will always work).
I've fixed the documentation in Subversion now.
Thanks for noticing!
On 01/11/2015 12:58 AM, Rafał Miłecki wrote:
> According to the documentation:
>> for a POST that fits into memory and that is encoded with a supported
>> encoding, the POST data will NOT be given in upload_data and is instead
>> available as part of MHD_get_connection_values();
> So I tried to trigger such case to understand it better. I wrote a
> simple handler and used curl as a client:
> curl -v -d "foo" http://127.0.0.1:8080/
> This is what I got:
> [access_handler] *con_cls:(nil) *upload_data_size:0
> [access_handler] *con_cls:0x16ff7a0 *upload_data_size:3
> [access_handler] *con_cls:0x16ff7a0 *upload_data_size:0
> It seems that my request:
> 1) Should fit memory (Content-Length: 3)
> 2) Should be supported (Content-Type: application/x-www-form-urlencoded)
> but POST was passed using upload_data anyway.
> Why did it happen? According to the documentation I expected
> *upload_data_size to be always 0. I also expected I'll need to use
> Two more comments from me:
> 1) Handling requests
> This would be nice to write something about handling POST data with
> 2) Adding a POST processor
> It doesn't mention MHD_get_connection_values at all.
Description: OpenPGP digital signature