libmicrohttpd
[Top][All Lists]
Advanced

[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


From: Christian Grothoff
Subject: Re: [libmicrohttpd] When exactly POST data won't be passed as upload_data?
Date: Sun, 11 Jan 2015 01:57:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0

Dear Rafal,

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!

Christian

On 01/11/2015 12:58 AM, Rafał Miłecki wrote:
> Hi,
> 
> According to the documentation:
> http://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dcb
>> 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
> MHD_get_connection_values().
> 
> 
> Two more comments from me:
> 
> 1) Handling requests
> http://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002drequests
> This would be nice to write something about handling POST data with
> MHD_get_connection_values
> 
> 2) Adding a POST processor
> http://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dpost
> It doesn't mention MHD_get_connection_values at all.
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]