On Fri, 5 Nov 2010 23:58:47 +0100 Basile Starynkevitch <bas...@starynkevitch.net> wrote: > Do you have an example of an HTTP server in libevent which handles a > POST request? > > Apparently, calling evbuffer_readline (hreq->input_buffer); from inside > a callback registered with evhttp_set_cb don't work as expected.
In fact, the POST-ed data is available with EVBUFFER_LENGTH (req->input_buffer) & EVBUFFER_DATA(req->input_buffer) as tge regress_http.c test example shows. But this is not well documented, and perhaps might not work for big data. Of course, in the usual case, the POST-ed data is coming from submitting an HTML form, so its Content-type is "application/x-www-form-urlencoded" and the application has to decode that. What I don't know is what happens when the web client (e.g. some Firefox browser in my case) sends the data in several write(2) or send (2) system calls. This probably could happen (I suppose) when the data is large enough (e.g >10kbytes), as could be the case when a TEXTAREA HTML element is implied. In that case, I don't understand if the libevent is buffering the entire HTTP request (so that the HTTP callback is always called once, after all the buffering succeeded) or not. Cheers. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} *** *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.