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

2012-11-20 Thread Mark Ellzey
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"); >

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

2012-11-20 Thread Mark Ellzey
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"); >

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

2012-11-19 Thread Nir Soffer
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

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

2012-11-19 Thread Pander
On 2012-11-19 21:59, Mark Ellzey wrote: > On Mon, Nov 19, 2012 at 10:12:53PM +0200, Nir Soffer wrote: >> On Mon, Nov 19, 2012 at 7:26 PM, Pander wrote: >> >>> Second question is regarding buffer_in in request. I can't seem to find >>> a proper example with helpers to retrieve the POST parameters. >

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

2012-11-19 Thread Mark Ellzey
On Mon, Nov 19, 2012 at 10:12:53PM +0200, Nir Soffer wrote: > On Mon, Nov 19, 2012 at 7:26 PM, Pander wrote: > > > Second question is regarding buffer_in in request. I can't seem to find > > a proper example with helpers to retrieve the POST parameters. > > > If you want to support the default f

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

2012-11-19 Thread Nir Soffer
On Mon, Nov 19, 2012 at 7:26 PM, Pander wrote: > Second question is regarding buffer_in in request. I can't seem to find > a proper example with helpers to retrieve the POST parameters. If you want to support the default form encoding (application/x-www-form-urlencoded), you can use evhttp_parse

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

2012-11-19 Thread Pander
On 2012-11-19 16:47, Mark Ellzey wrote: > On Mon, Nov 19, 2012 at 03:31:17PM +0200, Nir Soffer wrote: >> >> I don't think this is a good example for using libevent (maybe I do not >> understand what it does correctly). >> >> That server creates one event loop for accepting connections, and then one

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

2012-11-19 Thread Mark Ellzey
On Mon, Nov 19, 2012 at 03:31:17PM +0200, Nir Soffer wrote: > > I don't think this is a good example for using libevent (maybe I do not > understand what it does correctly). > > That server creates one event loop for accepting connections, and then one > event loop for each connection. Since the

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

2012-11-19 Thread Nir Soffer
On Mon, Nov 19, 2012 at 12:43 PM, Pander wrote: > On 2012-11-16 15:19, Nick Mathewson wrote: > > > > > > > > On Fri, Nov 16, 2012 at 5:49 AM, Pander > > wrote: > > > > Hi all, > > > > I am new to libevent and am wondering what to choose for a > > m

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

2012-11-19 Thread Pander
On 2012-11-16 15:19, Nick Mathewson wrote: > > > > On Fri, Nov 16, 2012 at 5:49 AM, Pander > wrote: > > Hi all, > > I am new to libevent and am wondering what to choose for a > multi-threated minimal and fast HTTP service that will run custom C

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

2012-11-16 Thread Nick Mathewson
On Fri, Nov 16, 2012 at 5:49 AM, Pander wrote: > Hi all, > > I am new to libevent and am wondering what to choose for a > multi-threated minimal and fast HTTP service that will run custom C code > for the POST requests it will get. > > Both libevent/http and lighttpd are candidates for my service

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

2012-11-16 Thread Pander
Hi all, I am new to libevent and am wondering what to choose for a multi-threated minimal and fast HTTP service that will run custom C code for the POST requests it will get. Both libevent/http and lighttpd are candidates for my service that has to be able to cope with *many* requests. Several e