[libmicrohttpd] Difference in handling of MHD_AccessHandlerCallback betw
From:
John Lee
Subject:
[libmicrohttpd] Difference in handling of MHD_AccessHandlerCallback between 0.4.4 and 0.4.6
Date:
Sat, 27 Mar 2010 15:35:29 +0000
Hello there, I've noticed that there is a difference between MHD_AccessHandlerCallback usage between 0.4.4 and 0.4.6. For example, sending a JSON object post payload of about ~450 bytes, *not* multi-part, *no* chunking.
1) 0.4.4 MHD_AccessHandlerCallback Call #1: upload_data points to the entire allocated POST payload *upload_data_size = 453 Create post processor and initialise state for the connection including the size of payload
MHD_AccessHandlerCallback Call #2: upload_data points to the entire allocated POST payload
*upload_data_size = 453 Call MHD_post_process to process POST data.
MHD_AccessHandlerCallback Call #3:
upload_data points to the entire allocated POST payload
*upload_data_size = 0 (i.e. finished processing the POST payload) The MHD_PostDataIterator function was never called, presumably because MHD could handle in one chunk. I pass the upload_data and stored size onto other network applications before replying to client.
The upload data memory is allocated for the entire duration of the HTTP request / response transaction.
2) 0.4.6 MHD_AccessHandlerCallback Call #1:
upload_data points to the entire allocated POST payload
*upload_data_size = 453
Create post processor and initialise state for the connection including the size of payload
...
MHD_AccessHandlerCallback Call #3:
upload_data points to NULL
*upload_data_size = 0 (i.e. finished processing the POST payload)
The upload data memory is no longer allocated? Is it up to the user to allocate memory for the POST payload?