[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] When exactly POST data won't be passed as upload_data?
From: |
Rafał Miłecki |
Subject: |
[libmicrohttpd] When exactly POST data won't be passed as upload_data? |
Date: |
Sun, 11 Jan 2015 00:58:34 +0100 |
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.
--
Rafał
- [libmicrohttpd] When exactly POST data won't be passed as upload_data?,
Rafał Miłecki <=