libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Processing post data


From: Keith Mendoza
Subject: Re: [libmicrohttpd] Processing post data
Date: Fri, 11 Jan 2013 09:33:17 -0800

Well I vaguely remembering running into a similar issue as yours, but now I don't remember what triggered it. Hopefully these 3 sections of code will help you with the issue you're running into: https://github.com/keithmendozasr/flat8/blob/master/src/server.cpp#L155
https://github.com/keithmendozasr/flat8/blob/master/src/server.cpp#L178
https://github.com/keithmendozasr/flat8/blob/master/src/server.cpp#L281

If you look through the mailing list archive you might find some discussion about this particular issue also.

HTH,
Keith


On Fri, Jan 11, 2013 at 8:01 AM, Sascha Swiercy <address@hidden> wrote:
Sorry to bother you again. I have some more questions/issues:

- I was a little confused that the callback type MHD_PostDataIterator
has a "kind" parameter, since I was expecting it to always be
MHD_POSTDATA_KIND. Then I investigated the source code and it seems to
me that this is indeed the only value passed to post iterators. So is
this really true so that we can ignore the "kind" parameter within the
callback function? In this case I would suggest to mention it in the
documentation. (You probably don't want to remove this parameter for
compatibility reasons, so I think a short note in the documentation
would be the best solution.)

- For MHD_POSTDATA_KIND the documentation states that post data might
be available either as normal upload data or as part of headers which
can be accessed through MHD_get_connection_values. I couldn't find an
example yet where the post data was not presented as upload data, even
with the small example given below. So is the documentation still true
regarding this statement? It would be convenient for the user if one
could rely on the fact that post data is always passed as upload data
so a post processor can always be used.

- I'd like to check the return value of MHD_destroy_post_processor
which works fine if I use "multipart/form-data" as encoding. But if I
send a request using "application/x-www-form-urlencoded", the function
MHD_destroy_post_processor always returns MHD_NO, at least when I use
firefox and the following HTML form to send the request:

------------------------
<form action="" href="http://localhost:8080/" target="_blank">http://localhost:8080/" method="post">
<input name="key1" type="text">
<input name="key2" type="text">
<input value="send" type="submit">
</form>
------------------------

The post processing works just fine but MHD_destroy_post_processor
indicates that something went wrong, which doesn't. From the source
code it looks like there are new line characters expected at the end
of post data, but there is no new line at the end of the request sent
by firefox. As far as I see from the HTTP specification the request
body is actually not required to end with a new line character. Did I
miss something?


Thanks again for your help.

Sascha



reply via email to

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