[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
>
the exported function from the documentation:
/**
* @brief Parses the query portion of the uri into a set of key/values
*
* Parses query arguments like "?herp=derp&foo=bar;blah=baz"
*
* @param query data containing the uri query arguments
* @param len size of the data
*
* @return evhtp_query_t * on success, NULL on error
*/
evhtp_query_t * evhtp_parse_query(const char * query, size_t len);
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.