Hi Christian,
I believe I have a solution: I have been using MHD_post_process() just
because it "was there", being used already for file uploads. What I
failed to ask myself was: is there another way of processing some
special Xml-Http-Request (xhr) Ajax POST requests?
The problem I ran into was that I provided a MHD_PostDataIterator
function, iterate_xhrf(), which, in the 1st pass through
[MHD_AccessHandlerCallback] answer_connection(), is linked to MHD as the
post processor:
con_info->postprocessor = MHD_create_post_processor( connection,
POSTBUFFERSIZE, iterate_xhrf, (void*)con_info );
Then, elsewhere, answer_connection() calls
MHD_post_process(con_info->postprocessor, upload_data, *upload_data_size);
..to process the incoming POSTs
..but, con_info->postprocessor, the link to iterate_xhrf(), passed as a
parameter to MHD_post_process(), DOES NOT call iterate_xhrf() when the
data destined for a file is sent embedded in an xhr request.
However, when a file is uploaded, instead of data embedded in a xhr
request, MHD_post_process() DOES call iterate_xhrf(). I believe the key
difference is the xhr request lacks some of the header information
enjoyed by a file upload; information such as [destination] filename and
content_type.
However, there is nothing stopping me from calling my own custom post
processor directly from answer_connection().
Bob
On 15-09-16 12:15 AM, Christian Grothoff wrote:
Hi Bob,
I do not understand your question at all. MHD_PostDataIterator is the
type of a function you need to provide to the MHD PP, not something you
'access'.
Also, I don't know what you are talking about with 'xdr data', maybe
you're talking about some Microsoft non-standard XDomainRequest
protocol, or something else non-standard? Anyway, the MHD PP supports
certain common HTTP POST encodings. If you require something
else/different, you need to write your own POST-processor. The MHD API
allows this, so there should be no problem for you if you can write your
own parser.
Happy hacking!
Christian
On 09/15/2015 08:18 PM, Bob Furber wrote:
Is there any way I can access a MHD_PostDataIterator when it is called
in a special situation where xhr data (not a file upload) is to be saved
to a file, instead of being a file upload? That is, data is uploaded
inside a xhr POST message, along with its destination path/filename.
It seems that MHD_PostDataIterator parameters such as filename must
pre-exist in order for the MHD_PostDataIterator to be called. Is there
any way around this?