libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Confused about MHD_PostDataIterator


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Confused about MHD_PostDataIterator
Date: Wed, 31 Mar 2010 23:33:27 +0200
User-agent: KMail/1.12.4 (Linux/2.6.31-14-generic; KDE/4.3.5; i686; ; )

On Saturday 27 March 2010 04:35:19 pm John Lee wrote:
> Hello there,
> I know that MHD_PostDataIterator is meant to iterate through the different
> parts / entities in a single HTTP message body (i.e. multi-part/form).
> However, is it meant to iterate through other types of POST messages also:
> 
> 1) For chunked transfer encoding, are the chunks meant to be forwarded to
> MHD_PostDataIterator for re-assembly? Alternatively, is this re-assembly
> meant to be done using upload_data and *upload_data_size of
> MHD_AccessHandlerCallback?

MHD (already before the PostProcessor would be involved) takes care of the 
chunking and presents only the data portions to the access handler.  So you 
will never see the chunk-encoding done by HTTP.  However, the data passed to 
the callback may of course be chunk-sized and may need to be incrementally 
processed (which the PostProcessor supports).  But ultimately, chunked 
encoding should make *no* difference for applications using MHD whatsoever 
(this is true in both directions).

As far as re-assembly is concerned, the PostProcessor will do so as needed, 
you do not need to copy the upload data into one big buffer first.  Simply 
give the individual chunks to the PP as they arrive.  
 
> 2) If a POST message comes in that is greater that POSTBUFFERSIZE (setting
> for MHD internal buffering) does, this mean that MHD shall break the
>  message into chunks of max size POSTBUFFERSIZE? In this case, is the data
>  sent to MHD_PostDataIterator for putting the chunks all together? Again
>  maybe these chunks are meant to be re-assembled using upload_data and
>  *upload_data_size of MHD_AccessHandlerCallback?

Yes, the POSTBUFFERSIZE only limits how much MHD will read into buffer from 
TCP (and hence determines the largest chunk that will be given to the access 
handler callback).  As long as it is  >1byte, the PostProcessor should then be 
able to put the chunks properly together for processing.  

I hope this helps.

Happy hacking

Christian




reply via email to

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