[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Beginners' question: multi-threaded HTTP service



On Tue, Nov 20, 2012 at 09:45:17AM +0200, Nir Soffer wrote:
> 
> On Nov 20, 2012, at 12:34 AM, Pander wrote:
> 
> >
> >only this works:
> >
> >char buf[1024];
> >int n;
> >while ((n = evbuffer_remove(req->buffer_in, buf, sizeof(buf))) > 0) {
> >   fwrite(buf, 1, n, stdout);
> >}
> >printf("\n");
> 
> Because in POST, browsers send the parameters in the request body.
> 
> For example, this form (assuming that your client is a browser):
> 
> <form method="POST">
> 	<input type="hidden" name="a" value="1">
> 	<input type="hidden" name="b" value="2">
> 	<input type="submit">
> </form>
> 
> Will turn into this POST request:
> 
> POST /path HTTP/1.1
> Content-Length: 7
> Content-Type: application/x-www-form-urlencoded
> 
> a=1&b=2
> 


Just pushed a patch to the develop tree which will treat the body as the
query arguments if no arguments have been parsed already.

This is not tested, so if you want to give it a shot, you can use the
develop tree to try.


***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.