[Libevent-users] Small patch for grabbing underlying event_base from an evhttp_request

2010-07-27 Thread Mark Ellzey
Greetings, Attached is a small patch which allows a user to grab the underlying event_base from an evhttp_request. I have patched this against the current master on github. If there is a better way to do this, I am open to suggestions. Thanks in advance! http.c|9 +

[Libevent-users] bufferevents and write signalling

2010-08-05 Thread Mark Ellzey
This is an odd question that hopefully someone can help me out with. I have a function right now that looks a bit like this: void read_data(struct bufferevent *bev, void *args) { evbuffer *data; data = bufferevent_get_input(bev) if (evbuffer_get_length(data) < some_size) {

Re: [Libevent-users] bufferevents and write signalling

2010-08-05 Thread Mark Ellzey
On Thu, Aug 05, 2010 at 02:09:50PM -0400, Nick Mathewson wrote: > Right. The read callback is invoked when more data *arrives,* not > whenever there is data. > > If you want it to handle all the data, why not just use a loop: > >while (evbuffer_get_length(data) >= some_size) { >/* ..

Re: [Libevent-users] Dynamic changes of read water mark

2010-08-31 Thread Mark Ellzey
On Sun, Aug 29, 2010 at 08:08:12AM -0700, Gilad Benjamini wrote: > My eventloop needs to go through this cycle >- Read 16 bytes off the network >- The 16 bytes contain a length parameter >- Read additional "length" bytes from the network. > > It seems that this can be done with a buffe

Re: [Libevent-users] Dynamic changes of read water mark

2010-09-02 Thread Mark Ellzey
On Wed, Sep 01, 2010 at 10:06:44AM -0700, Gilad Benjamini wrote: > Your sample code did not include the watermark part. It doesn't need to. > May I assume that at the end of the code snippet you would set the low > watermark ? No. > If I set the low watermark to X, am I guaranteed that the next

Re: [Libevent-users] Re: help with debugging

2010-09-18 Thread Mark Ellzey
On Fri, Sep 17, 2010 at 10:29:08AM -0400, Nick Mathewson wrote: > On Fri, Sep 17, 2010 at 5:22 AM, Mihai Draghicioiu > wrote: > [...] > > Core was generated by `/home/mihai/frogmod-justice/frogserv'. > > Program terminated with signal 11, Segmentation fault. > > [New process 14829] > > #0 ?evhttp_

Re: [Libevent-users] Re: libevent: HTTP POST service example?

2010-11-06 Thread Mark Ellzey
On Sat, Nov 06, 2010 at 12:07:32PM -0400, Ron Parker wrote: > Basile, > > It was my experience with libevent 1.4 that the entire post was buffered > prior to callback. At a very minimum this opened my system up to a DOS > attack. Since I didn't find a way to get incremental callbacks in the end

Re: : [Libevent-users] help

2010-11-17 Thread Mark Ellzey
On Tue, Nov 16, 2010 at 10:26:59AM -0600, Steven Veneralle wrote: > whenever I did my make I got he following > /sizes: error while loading shared libraries: libevent-1.4.so.2: cannot open > shared object file: No such file or directory > make: *** [test] Error 127 > > abd this error after it trie

Re: [Libevent-users] Threaded event bases

2010-12-21 Thread Mark Ellzey
On Sat, Dec 18, 2010 at 08:31:23PM -0500, Kevin Bowling wrote: > One of the ideas I saw floating around for libevent 2.1 was threaded event > bases to ease thread pool programming. > > This seems like a pretty challenging project and probably beyond my > abilities at the moment but if we can hash

Re: [Libevent-users] Buffer event race condition

2010-12-21 Thread Mark Ellzey
On Mon, Dec 20, 2010 at 01:32:50AM -0500, Kevin Bowling wrote: > I'm at wit's end with a libevent threading bug. As part of a disconnect > client routine, I manually call the errorcb with EVENT_ERROR_EOF. The idea > was to keep all the cleanup code in one callback but I'm beginning to think > thi

Re: [Libevent-users] Threaded event bases

2010-12-21 Thread Mark Ellzey
On Tue, Dec 21, 2010 at 11:02:25AM -0500, Evan Jones wrote: > You can do this with libevent 2.0, using thread-safe event loops, > and using event_active() to "trigger" an event to be run in another > thread. I've never had much luck with event_active across multiple threads, though this may be bec

Re: [Libevent-users] http server and infinite streams

2011-04-26 Thread Mark Ellzey
On Tue, Apr 26, 2011 at 10:49:46AM -0700, Cliff Frey wrote: > Also, a completely different bug: ?If you want to support potentially > infinite POST streams from clients (imagine that you wanted to > implement word-count as an http server, where they POST a document, > and you return the word count)

Re: [Libevent-users] http server and infinite streams

2011-05-09 Thread Mark Ellzey
On Sat, May 07, 2011 at 01:07:40AM -0400, Nick Mathewson wrote: > *lots of text here* One of the ways nginx deals with very large streams of data is to actually spool the data to file. By default this is turned off. But this may be a simple solution to all of these problems. The spooling is tra

Re: [Libevent-users] http server and infinite streams

2011-05-09 Thread Mark Ellzey
I think it may this may be a good time for Cliff, Vector, Scott, myself, and input/time from Nick to give a shot creating a secondary http API (keeping the old one in place). This thread has been full of good ideas and experimental implementations. A call to arms? ***

Re: [Libevent-users] http server and infinite streams

2011-05-10 Thread Mark Ellzey
On Tue, May 10, 2011 at 09:04:42AM +0200, Roman Puls wrote: > whilst this might be nice for flow-blown web services, this does not > work for embedded systems that have no or very limited disk storage. > > Also, this pattern disables effective stream handling, e.g. where > you don't want to store

Re: [Libevent-users] http server and infinite streams

2011-05-10 Thread Mark Ellzey
On Tue, May 10, 2011 at 04:14:42PM -0700, Scott Lamb wrote: > It occurs to me by "install a handler for" you might be meaning a > custom filesystem via kernel module or FUSE or something. I don't like > that either; I never said nor implied such a thing. **

Re: [Libevent-users] http server and infinite streams

2011-05-10 Thread Mark Ellzey
On Tue, May 10, 2011 at 04:04:27PM -0700, Scott Lamb wrote: > I don't see the point in libevent implementing spooling to a file > (descriptor). If an application wants that, it can implement it on top > of the existing evhttp_request_set_chunked_cb + the fairly small > patches being proposed (call

Re: [Libevent-users] http server and infinite streams

2011-05-10 Thread Mark Ellzey
I just whipped up a quick bare-bones http server using only bufferevents and a MIT licensed http parser (which if I am not mistaken - is compatible with bsd). https://github.com/ellzey/bufferevent_http_parser/blob/master/evhttp.c This is the type of control I would look for in a http request pro

Re: [Libevent-users] http server and infinite streams

2011-05-11 Thread Mark Ellzey
On Wed, May 11, 2011 at 04:20:33AM -0700, Scott Lamb wrote: > It's libevent's doom, too: the extra code for spooling is a > maintenance burden. I don't like options C or D. > I am officially out of this thread. This back and forth has obviously derailed with reasons-why-not instead of how-about-w

[Libevent-users] libevhtp beginnings API

2011-05-14 Thread Mark Ellzey
I have created a new project called libevhtp, a server-only replacement for the current libevent http API. The API utilizes a streaming http parser, which allows me to hook into a lot of places. You can treat the API just like you would normal evhttp_* calls, but instead use evhtp_*. The flexibil

Re: [Libevent-users] libevhtp beginnings API

2011-05-16 Thread Mark Ellzey
On Sun, May 15, 2011 at 06:24:02PM +0800, lx wrote: > i'll try to use it. > Thanks, I just pushed a bunch of chances including a few more hook mechanisms. A more refined 1.0 vs 1.1 compatability set. Some initial perf testing with httperf comparing test.c (from libevhtp) and http_bench (from l

Re: [Libevent-users] libevhtp beginnings API

2011-05-23 Thread Mark Ellzey
> On Mon, May 16, 2011 at 10:30 PM, Mark Ellzey wrote: > Are you the copyright holder? If so, why not stick to BSD to keep > things simple. > > Kevin As an FYI, Libevent already does a good job of keeping track of all non-BSD specific code in their LICENCE file. But

Re: [Libevent-users] libevhtp beginnings API

2011-05-25 Thread Mark Ellzey
On Wed, May 25, 2011 at 11:11:49PM +0200, Aleksandar Lazic wrote: > Dear Mark, > > What do you think about to use the mongrel2 parser? > > https://github.com/zedshaw/mongrel2 > > => mongrel2/src/http11 The general arch seems to be completely derived from ry (backend structs look pretty much the

Re: [Libevent-users] Visual C++ Projects

2011-07-01 Thread Mark Ellzey
On Thu, Jun 30, 2011 at 05:13:05PM -0700, Kun Xi wrote: > I once played with libevent using cmake and msys. It is really fun: > - free and familiar toolchain: gcc, gdb > - portability > - cross-compiling from linux host > > cmake can generate NMAKE makefile. I have never tried to use Visual > C

Re: [Libevent-users] Question on paired buffer events

2011-07-01 Thread Mark Ellzey
On Thu, Jun 30, 2011 at 01:53:12PM -0400, Ed Day wrote: > I then went into the event dispatch loop and immediately fell out the bottom. > > Is this not the correct way to use these events? > What does "fell out the bottom" mean? *

Re: [Libevent-users] Question on paired buffer events

2011-07-01 Thread Mark Ellzey
On Fri, Jul 01, 2011 at 11:51:28AM -0400, Ed Day wrote: > By "fell out the bottom" I mean returned immediately. > > Ed > > Correct, if there are no events in a base, the loop terminates. Normally you use them in situations where you have other things going on. I am assuming this is derived via

Re: [Libevent-users] message loop

2011-07-06 Thread Mark Ellzey
On Wed, Jul 06, 2011 at 07:04:51PM +0200, mosta wrote: > hi, > > is there a API for over taking the message loop? Can you clarify what you mean by "message loop"? *** To unsubscribe, send an e-mail to majord...@freehaven.net with

Re: [Libevent-users] message loop

2011-07-06 Thread Mark Ellzey
On Wed, Jul 06, 2011 at 08:01:11PM +0200, mosta wrote: > On 07/06/11 19:39, Mark Ellzey wrote: > > Can you clarify what you mean by "message loop"? > I mean the event base loop. Can you clarify what yo

Re: [Libevent-users] message loop

2011-07-06 Thread Mark Ellzey
On Wed, Jul 06, 2011 at 10:23:57PM +0200, mosta wrote: > That I run the main loop and call a function that handles what's > happening in the event base loop. If I grok this correctly, you are asking whether you can get a list of currently active events in an event_base? ***

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
On Mon, Jul 11, 2011 at 10:35:46AM +0200, Andrei Chirila wrote: > Hello, > > I'm using libevent in some programs and I came across a memory leak in > libevent. I'm wondering if I'm the one doing something wrong or it's really > something in libevent. > What version are you using? I just browsed

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
On Mon, Jul 11, 2011 at 10:55:16AM -0500, Mark Ellzey wrote: > On Mon, Jul 11, 2011 at 10:35:46AM +0200, Andrei Chirila wrote: > > Hello, > > > > I'm using libevent in some programs and I came across a memory leak in > > libevent. I'm wondering if I'm th

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
Ah, this is a global lock. Unfortunately there doesn't seem to be a way to free that, is it a big issue? this is small, one time allocat, and handled by dtor's. *** To unsubscribe, send an e-mail to majord...@freehaven.net with

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
On Mon, Jul 11, 2011 at 06:06:22PM +0200, Andrei Chirila wrote: > Hello, > > I just tried with the latest: > Try compiling with --disable-debug-mode *** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
int event_global_setup_locks_(const int enable_locks) { #ifndef _EVENT_DISABLE_DEBUG_MODE EVTHREAD_SETUP_GLOBAL_LOCK(_event_debug_map_lock, 0); #endif is your issue. so yeah, --disable-debug-mode will fix that problem. On Mon, Jul 11, 2011 at 11:26:28AM -0500, Mark Ellzey wrote: > On

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
Yeah I see it now - not a huge issue but I will submit a patch here soon. *** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-usersin the body.

Re: [Libevent-users] Libevent memory leak?

2011-07-11 Thread Mark Ellzey
rote: > Hi Mark, > > Thank you for your interest in this issue. > > Best regards, > Andrei > > On Mon, Jul 11, 2011 at 7:33 PM, Mark Ellzey wrote: > > > Yeah I see it now - not a huge is

Re: [Libevent-users] Libevent memory leak?

2011-07-12 Thread Mark Ellzey
On Tue, Jul 12, 2011 at 12:20:16AM -0400, Nick Mathewson wrote: > On Mon, Jul 11, 2011 at 2:40 PM, Mark Ellzey wrote: > Looks like a good start; see the comments on your pull request. Updated per request. *** To unsub

Re: [Libevent-users] Re: [PATCH]: libevent/dns DNS_ERR_NOANSWERS

2011-08-10 Thread Mark Ellzey
On Wed, Aug 10, 2011 at 04:56:27PM +0400, Leonid Evdokimov wrote: > + } else if (reply && !reply->have_answer) { > + error = DNS_ERR_NOANSWER; > + } else { > + error = DNS_ERR_UNKNOWN; > } There is an odd edge-case in dns. DNS_E

Re: [Libevent-users] API question: struct evkeyval

2011-08-10 Thread Mark Ellzey
On Wed, Aug 10, 2011 at 07:39:02PM +0400, Leonid Evdokimov wrote: > evhttp_parse_query and evhttp_parse_query_str require preallocated > struct evkeyvalq that has unstable ABI according to section 2.1 of > whatsnew-2.0.txt > > But these functions are placed in "stable ABI" header event2/http.h >

Re: [Libevent-users] libevent http and lost requests

2011-08-11 Thread Mark Ellzey
On Thu, Aug 11, 2011 at 09:19:41PM +0300, about bus wrote: > Hello! > > I have a simple my own libevent-based http server written on C, use evhttp.h > functions. > I use it like backend with nginx server (about ~2K requests per second). > Sometimes in nginx error log appears error: "(60: Operation

Re: [Libevent-users] libevent http and lost requests

2011-08-12 Thread Mark Ellzey
On Fri, Aug 12, 2011 at 06:36:18PM +0300, about bus wrote: > On Fri, Aug 12, 2011 at 4:57 PM, Leonid Evdokimov wrote: > > > What libevent version do you use? > > Can you reproduce the issue with ab (apache benchmark) instead of nginx? > > > > -- > > > > Libevent from sources: libevent-2.0.12-sta

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-12 Thread Mark Ellzey
On Fri, Aug 12, 2011 at 09:48:20PM +0300, about bus wrote: > I've added some debug output in libevent functions, added "fd" (file > descriptor) in every output message. > messages from libevent - [warn] > messages from my http server - v[3] > Also I've changed timeout in nginx config from 75 to 30,

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-15 Thread Mark Ellzey
On Sun, Aug 14, 2011 at 04:15:10PM +0300, about bus wrote: > I've checked this, domain name resolution does not take much time. > Issue somewhere between end of evhttp_socket_cb and start of evhttp_read_cb > functions calls. > > 2011.08.14 16:52:27 [warn] === evhttp_socket_cb: fd: 131 > 2011.08.1

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-16 Thread Mark Ellzey
On Tue, Aug 16, 2011 at 12:28:21PM +0300, about bus wrote: > No, I don't, because they output very huge, and I don't know what exactly I > should looking there. I think I have missed asking some basic questions. - What version of libevent are you using? - What operating system and event backend

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-16 Thread Mark Ellzey
On Mon, Aug 15, 2011 at 01:53:18PM +0300, about bus wrote: > Http server use only libevent http functions for network communication. > > evthread_use_pthreads; So the webserver is threaded? > event_base_new > evhttp_new > evhttp_set_gencb > evhttp_bind_socket > while (1) { >event_base_loop >

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-16 Thread Mark Ellzey
On Tue, Aug 16, 2011 at 09:47:07AM -0500, Mark Ellzey wrote: > On Tue, Aug 16, 2011 at 12:28:21PM +0300, about bus wrote: > > No, I don't, because they output very huge, and I don't know what exactly I > > should looking there. > > I think I have missed asking som

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-16 Thread Mark Ellzey
On Tue, Aug 16, 2011 at 05:59:19PM +0300, about bus wrote: > I've added debug output to next libevent functions: > * event_add - add file descriptor to kqueue for monitoring network activity. > * kq_dispatch - return file descriptor when event appeared on it. > > ### Previous request which used th

Re: [Libevent-users] Re: libevent http and lost requests

2011-08-16 Thread Mark Ellzey
On Tue, Aug 16, 2011 at 06:24:08PM +0300, about bus wrote: > On Tue, Aug 16, 2011 at 6:08 PM, Mark Ellzey wrote: > > > OK, this makes sense. there have been issues with kqueue being broken on > > older > > versions of libevent (a while back, with 1.x), try falling ba

Re: [Libevent-users] [PATCH] Add Host header in HTTP/1.1 requests if it's missing.

2011-08-19 Thread Mark Ellzey
On Fri, Aug 19, 2011 at 03:14:12PM +0400, Leonid Evdokimov wrote: > From a87fc928f7a61ca691861154ffd9ba3e6aec0397 Mon Sep 17 00:00:00 2001 > From: Leonid Evdokimov > Date: Fri, 19 Aug 2011 14:47:20 +0400 > Subject: [PATCH 6/6] Add Host header in HTTP/1.1 requests if it's missing. > > --- > http.

Re: [Libevent-users] https support within libevent

2011-08-30 Thread Mark Ellzey
On Tue, Aug 30, 2011 at 09:56:01PM +0200, Graham Leggett wrote: > Hi all, > > I have seen mention of support for https from within libevent, but > I'm struggling to find details of where to find it. Is there any > example code anywhere to show how one might support such a thing? > There is no di

Re: [Libevent-users] undefined reference to `bufferevent_get_input'

2011-08-31 Thread Mark Ellzey
On Wed, Aug 31, 2011 at 09:00:17PM +0800, lx wrote: > hello, i'm a new one , begin to use libevent. i've installed it in ubuntu10. > > by ./configure, make , sudo make install. > but when i complie a example, it can't work.* the errors is:* > > ---

Re: [Libevent-users] https support within libevent

2011-08-31 Thread Mark Ellzey
On Tue, Aug 30, 2011 at 05:54:42PM -0400, Nick Mathewson wrote: > Neat! APIwise, is there also a way to just pass in an SSL_CTX or use > a factory function to create SSL objects? This kind of "config > structure" trick is neat, but a lot of time, I need to do some pretty > heavy unanticipated SS

Re: [Libevent-users] mysql client with libevent

2011-08-31 Thread Mark Ellzey
On Wed, Aug 31, 2011 at 07:28:59PM -0700, William Ahern wrote: > FWIW, the PostgreSQL C client API works non-blocking. It's quite well > designed. > I wrote this years ago so mind the crappy code (not to mention pre levent2), but it's a good example of how to use libevent + nonblocking pgsql. h

Re: [Libevent-users] mysql client with libevent

2011-09-01 Thread Mark Ellzey
On Thu, Sep 01, 2011 at 11:34:11AM -0500, Nulik Nol wrote: > But ... I think it is over for me with SQL type databases. There is a > big movement going on on non-relational databases and I think it is > time to change. Most if not all (widely used) relational databases these days expose some type

Re: [Libevent-users] mysql client with libevent

2011-09-02 Thread Mark Ellzey
On Fri, Sep 02, 2011 at 10:52:17AM -0500, Nulik Nol wrote: > > > > Crap, I just realized this is completely off topic - but my main point > > is to gather requirements, and make a determination if you're willing to > > risk flexibility for possible bumps in performance. Or just abstract the > > fra

Re: [Libevent-users] Question about internal event mechanism

2011-09-07 Thread Mark Ellzey
On Wed, Sep 07, 2011 at 10:22:15PM +1000, Jim Tink wrote: > Could someone provide a small overview on how libevent supports these? IE Is > it based on the operating system or context of when an event is created or > something like that? Is it something that I would control as a developer > etc? Th

Re: [Libevent-users] Different behavior of my code

2011-09-08 Thread Mark Ellzey
> Nonblocking I/O has not much to do with it, you don't necessarily need > nonblocking I/O if you have working poll(2) or select(2). > > It is a limitation of OS X. Every other platform with kqueue(2) and all > I am aware of with poll(2) support it on all file descriptors. OS X > doesn't support i

Re: [Libevent-users] immediately flushing bufferevents

2011-10-03 Thread Mark Ellzey
On Mon, Oct 03, 2011 at 11:59:58AM +0200, Micha? Kr?l wrote: > Hi, > > I'm writing distributed application using the newest version of libevent > (2.0.14). To read and write from/to sockets I use recv,send statement and it > works perfectly. Now I want to use SSL support provided by libevent. In >

Re: [Libevent-users] Re: Avoid potential SSL read spinlocks

2011-11-14 Thread Mark Ellzey
On Mon, Nov 14, 2011 at 11:03:58AM -0800, Catalin Patulea wrote: > Hi, > > Why does bev_ssl require deferred callbacks? > As far as I know, it doesn't. But I wrote this patch because if you are using a deferred bev with bulk incoming data, it never drops back into base_loop() until SSL_read() sa

Re: [Libevent-users] Re: Avoid potential SSL read spinlocks

2011-11-14 Thread Mark Ellzey
On Mon, Nov 14, 2011 at 02:30:32PM -0800, Catalin Patulea wrote: > This is actually causing an assert in my case :( The key is to get > SSL_read to return both data (> 0) and EOF (= 0) within the same > iteration of that (former) while loop. Then the flow looks like this: > > SSL_read() returns N

Re: [Libevent-users] Re: Avoid potential SSL read spinlocks

2011-11-14 Thread Mark Ellzey
On Mon, Nov 14, 2011 at 07:13:39PM -0600, Mark Ellzey wrote: > > We cannot schedule or call the readcb UNTIL SSL_read() returns > 0 OR an > error occurs on the socket. I definitely feel confident this is the issue, going into that loop provided ample time for SSL_read() to proce

Re: [Libevent-users] Re: Avoid potential SSL read spinlocks

2011-11-15 Thread Mark Ellzey
On Mon, Nov 14, 2011 at 07:21:00PM -0600, Mark Ellzey wrote: > On Mon, Nov 14, 2011 at 07:13:39PM -0600, Mark Ellzey wrote: > > > > We cannot schedule or call the readcb UNTIL SSL_read() returns > 0 OR an > > error occurs on the socket. > > I definitely feel conf

Re: [Libevent-users] Re: Avoid potential SSL read spinlocks

2011-11-15 Thread Mark Ellzey
On Tue, Nov 15, 2011 at 10:48:10AM -0600, Mark Ellzey wrote: > On Mon, Nov 14, 2011 at 07:21:00PM -0600, Mark Ellzey wrote: > > On Mon, Nov 14, 2011 at 07:13:39PM -0600, Mark Ellzey wrote: > > > > > > We cannot schedule or call the readcb UNTIL SSL_read() returns >

Re: [Libevent-users] ANN: Libevent 2.0.16-stable is released

2011-11-18 Thread Mark Ellzey
On Fri, Nov 18, 2011 at 05:51:07PM -0800, Rich Onyon wrote: > I dont see any content? > > > Sent from my Verizon Wireless Device Probably because you were reading from a verizon wireless device. *** To unsubscribe, send an e-mai

Re: [Libevent-users] pause bufferevent callback

2011-11-29 Thread Mark Ellzey
On Tue, Nov 29, 2011 at 06:58:15AM -0800, Ivan Popovski wrote: > Hi. > > Sorry on newbie question. > > Is there way to pause read callback, because i have fixed length buffer? > and in one moment need to avoid overflow and stop readcb until other > module consumes data (or other conditions are me

Re: [Libevent-users] [PATCH] client HTTPS with evhttp

2011-12-12 Thread Mark Ellzey
Would you mind submitting the patch branched against patches-2.0 on github? Easier to pull in / comment / test. On Mon, Dec 12, 2011 at 11:57:17AM -0800, Myk Taylor wrote: > >I've written up a patch that allows evhttp to work for HTTPS where a > >second (or further) request is sent on a evhttp_co

Re: [Libevent-users] PATCH: bufferevent_openssl consider_read doesn't drain underlying BE in all cases

2011-12-19 Thread Mark Ellzey
On Mon, Dec 19, 2011 at 05:45:51PM -0500, Catalin Patulea wrote: > > Ps - I haven't tried to reproduce this bug in a stand alone project yet. > Would you be able to provide a repro, or at least some more in-depth > description of the conditions that prompted the issue to surface? I think I have b

Re: [Libevent-users] PATCH: bufferevent_openssl consider_read doesn't drain underlying BE in all cases

2011-12-19 Thread Mark Ellzey
On Mon, Dec 19, 2011 at 07:34:50PM -0600, Mark Ellzey wrote: > I think I have been able to reproduce this using ssl client + filters. > More on this in a bit. This seems to fix the issue: - n_to_read = SSL_pending(bev_ssl->ssl); + if (!(n_to_read = SS

Re: [Libevent-users] PATCH: bufferevent_openssl consider_read doesn't drain underlying BE in all cases

2011-12-19 Thread Mark Ellzey
On Mon, Dec 19, 2011 at 07:34:50PM -0600, Mark Ellzey wrote: > I think I have been able to reproduce this using ssl client + filters. > More on this in a bit. I reproduced by running: sample/le-proxy -s 127.0.0.1:8080 127.0.0.1:443 where the 443 host is a https server. Made a 2GB POST, w

Re: [Libevent-users] PATCH: bufferevent_openssl consider_read doesn't drain underlying BE in all cases

2011-12-19 Thread Mark Ellzey
On Mon, Dec 19, 2011 at 09:57:08PM -0500, Nick Mathewson wrote: > I agree with the part of your fix where we don't ignore the extra data > whose presence is indicated by a nonzero SSL_pending. > > But I think these fixes all have some problem(s) in common: They > ignore the reason for the logic

Re: [Libevent-users] PATCH: bufferevent_openssl consider_read doesn't drain underlying BE in all cases

2011-12-22 Thread Mark Ellzey
On Thu, Dec 22, 2011 at 01:33:28PM +0500, Haseeb Abdul Qadir wrote: > What you guys mean when you say 'build correct infrastructure'? Does it mean > the ability to schedule callbacks and guarantee that callbacks will called in > the order they've been queued? For example a timer callback with a t

Re: [Libevent-users] Problems with deferred HTTP handlers over SSL

2012-01-14 Thread Mark Ellzey
On Fri, Jan 13, 2012 at 07:13:09PM -0600, Amarin Phaosawasdi wrote: > Hi Oscar, > > Thanks for following up. > > We tried building and linking with the same versions of libevent, libevhtp > as static libraries, and openssl as a shared library as you did on our > Linux machines and still got the s

Re: [Libevent-users] Problems with deferred HTTP handlers over SSL

2012-01-16 Thread Mark Ellzey
On Sun, Jan 15, 2012 at 09:28:23PM -0600, Hochhaus, Andrew wrote: > I modified Amarin's test program to call evthread_use_pthreads() > [attached]. I also added BEV_OPT_THREADSAFE to the > bufferevent_openssl_socket_new/bufferevent_socket_new calls in > evhtp.c. > > This improves things, however, I

Re: [Libevent-users] bufferevent openssl deadlock

2012-02-24 Thread Mark Ellzey
On Fri, Feb 24, 2012 at 07:14:58PM -0600, Amarin Phaosawasdi wrote: > Hello, > > About a year ago, there was a thread about deadlocking in > bufferevent_openssl in multi-threaded mode ( > http://archives.seul.org/libevent/users/Jan-2011/msg00019.html). > > We've run into the same problem. > Her

Re: [Libevent-users] bufferevent openssl deadlock

2012-02-24 Thread Mark Ellzey
On Fri, Feb 24, 2012 at 07:39:26PM -0600, Mark Ellzey wrote: > On Fri, Feb 24, 2012 at 07:14:58PM -0600, Amarin Phaosawasdi wrote: > > Hello, > > > > About a year ago, there was a thread about deadlocking in > > bufferevent_openssl in multi-threaded mode ( > >

Re: [Libevent-users] https client

2012-03-09 Thread Mark Ellzey
On Thu, Mar 08, 2012 at 09:39:23PM +0400, Alexey Ozeritsky wrote: > Hello, > > I cannot get https client working. > I have tried 2 servers (apache2 and nginx). > > libevent 2.0.17+ssl-patches and current git version give the same result. > > nginx access_log: > 127.0.0.1 - - [08/Mar/2012:21:08:3

Re: [Libevent-users] segfault issue

2012-03-22 Thread Mark Ellzey
On Thu, Mar 22, 2012 at 07:11:01PM -0300, William Lima wrote: > Hi! > > I'm using bufferevent in my proxy project and I have a bug. The entire > program is single-thread, but apparently the error callback can be called > while something is still running (ie. a parser) into server/client read > cal

Re: [Libevent-users] segfault issue

2012-03-22 Thread Mark Ellzey
On Thu, Mar 22, 2012 at 08:18:21PM -0500, Mark Ellzey wrote: > On Thu, Mar 22, 2012 at 07:11:01PM -0300, William Lima wrote: > > Hi! > > > > I'm using bufferevent in my proxy project and I have a bug. The entire > > program is single-thread, but apparently

[Libevent-users] Request for input on pending bufferevent_openssl patch.

2012-04-20 Thread Mark Ellzey
Greetings all, I have recently come across a pretty nasty issue using the bufferevent_openssl API where my read callback would be executed more than once, even if I had disabled reading. This is an edge-case bug which can be triggered under the following conditions: 01. bufferevent_enable(ssl_b

Re: [Libevent-users] [patch] integer recommendations

2012-04-23 Thread Mark Ellzey
On Mon, Apr 23, 2012 at 09:04:59AM -0400, Mansour Moufid wrote: > Hi, > > Here's a patch to adhere to a few of the integer-related recommendations in > the CERT C Secure Coding Standard. I tried not to break anything but you may > want to double-check. > > Mansour > It seems as if the tool be

[Libevent-users] Introducing RProxy (and a re-introduction to libevhtp)

2012-05-21 Thread Mark Ellzey
Today, my employer is making available a highly efficient reverse HTTP(S) proxy called simply 'RProxy'. This project is being released open-source to encourage the general community to participate in its evolution. My employer always avoids trying to re-invent the wheel when it comes to software,

Re: [Libevent-users] Introducing RProxy (and a re-introduction to libevhtp)

2012-05-21 Thread Mark Ellzey
On Mon, May 21, 2012 at 06:56:22PM +0200, Vincent Bernat wrote: > Did you try haproxy + stunnel or haproxy + stud? Your project seems > pretty interesting. I plan to benchmark it against other HTTP SSL > termination solutions. We tried on these and many others. They have their upsides

Re: [Libevent-users] Libevent evhttp File handles increase issue resolved

2012-05-30 Thread Mark Ellzey
On Wed, May 30, 2012 at 09:36:07AM +0500, Shahid wrote: > We have tried some use cases and found out that it is due to the fact that > we are holding the requests to send the response when available. The default > holding time is 60 seconds after that we send a TIMEOUT response. > > These kind of

Re: [Libevent-users] Re: Crash in evhttp_send_reply_chunk()

2012-05-31 Thread Mark Ellzey
On Thu, May 31, 2012 at 06:32:38AM -0700, Alap Kumar Sinha wrote: > Hi, > > Any help on this please? > > Regards, > Alap > Can you either put this up on pastebin/gist, or make the code an attachment? You are using a non-plaintext encoding so it's kind of hard to read. *

Re: [Libevent-users] Re: Crash in evhttp_send_reply_chunk()

2012-05-31 Thread Mark Ellzey
On Thu, May 31, 2012 at 06:48:32AM -0700, Alap Kumar Sinha wrote: > Hi, > > I have attached code snippet. Please let me know if it is better now. > > Regards, > Alap > Use evthread_use_pthreads() before anything else and compile with -levent_pthreads. You cannot use events across different threa

Re: [Libevent-users] How to limit the read/write( input/output ) traffic?

2012-06-13 Thread Mark Ellzey
On Wed, Jun 13, 2012 at 10:39:01PM +0800, zhengfish wrote: > Hi, all > I want to shape the read/write traffic, I check the data-structure > I find there are 4 members in the struct bufferevent which maybe do > that function. > However I don't know how to do it in detail steps. > Any

Re: [Libevent-users] Crash in my simple multi-threaded evhttp app [code incl.]

2012-06-27 Thread Mark Ellzey
On Wed, Jun 27, 2012 at 11:02:04AM -0700, Julian Bui wrote: > Hi libevent, > > Sorry for the recent surge of emails. I am trying to determine the cause > of a problem in my application while using evhttp. I wrote a toy/dummy > server (whose code I included) that exhibits the same problem that my

Re: [Libevent-users] Crash in my simple multi-threaded evhttp app [code incl.]

2012-06-27 Thread Mark Ellzey
On Wed, Jun 27, 2012 at 02:37:22PM -0500, Mark Ellzey wrote: > On Wed, Jun 27, 2012 at 11:02:04AM -0700, Julian Bui wrote: > > Hi libevent, > > > > Sorry for the recent surge of emails. I am trying to determine the cause > > of a problem in my application while using e

Re: [Libevent-users] bufferevent with custom IO

2012-09-07 Thread Mark Ellzey
On Thu, Sep 06, 2012 at 11:30:54PM +0200, Joachim Bauch wrote: > Thanks for the heads up. The socket-based code surely will be helpful > when the implementation starts. I wrote an initial draft of how the > API could look like and put it on github: > https://github.com/fancycode/Libevent/blob/buf

Re: [Libevent-users] draining bufferevents internal buffer

2012-09-21 Thread Mark Ellzey
On Fri, Sep 21, 2012 at 09:25:43PM +0200, Julian Scheel wrote: > Hi, > > I wonder if there is a way to drain the internal buffer of a bufferevent? > Actually I use a bufferevent to write data into a socket. But it can happen > that the socket is not accepting data for a while, which obviously le

Re: [Libevent-users] how to jude is the bufferevent has been free

2012-10-09 Thread Mark Ellzey
On Tue, Oct 09, 2012 at 06:05:57PM +0800, rqslt wrote: > ??? 2012???10???09??? 17:05, Nir Soffer ??: > > > >On Oct 9, 2012, at 6:12 AM, rqslt wrote: > > > >> I want know how to jude is the bufferevent has been free. In > >>function A , i use bufferevent_free free the bufferevetn; In > >>fucti

Re: [Libevent-users] Multi-threading question

2012-10-10 Thread Mark Ellzey
On Tue, Oct 09, 2012 at 06:22:08PM -0400, Programmist Setevik wrote: > 1) "Main" thread that does something like this, (pseudo code): > > for ( all configured listen ports) { > FD = socket() > bind() > set non-block() > listen > add FD to a list > > } > > for (configurable # of worker thr

Re: [Libevent-users] Multi-threading question

2012-10-10 Thread Mark Ellzey
On Wed, Oct 10, 2012 at 01:16:20PM -0400, Programmist Setevik wrote: > Mark - > > that each worker performs independent accept() - by monitoring the shared > listener FD on its own event_base ? > This. *** To unsubscribe, send

Re: [Libevent-users] SSL NPN with libevent

2012-10-10 Thread Mark Ellzey
On Wed, Oct 10, 2012 at 01:19:31PM -0400, Programmist Setevik wrote: > Is there an easy/supported way to have OpenSSL 1.x perform NPN negotiation > while using libevent's support for OpenSSL ? > Need to be told what SSL ended up selecting , from the proposed list of > protos. > > Any code examples

Re: [Libevent-users] libevent + curl

2012-10-22 Thread Mark Ellzey
On Mon, Oct 22, 2012 at 11:08:23PM +, John Dunn wrote: > I'm trying to modify the hiperfifo.c example included in libcurl > (http://curl.haxx.se/libcurl/c/hiperfifo.html ) to use libevent 2.0.20 and > had a few questions. I know the originator of this code is the libcurl people > but I figur

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 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-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] Q: Exception callbacks and events that should run immediately

2012-12-05 Thread Mark Ellzey
On Wed, Dec 05, 2012 at 11:10:04AM +0200, Nir Soffer wrote: > On Wed, Dec 5, 2012 at 10:54 AM, Sashan Govender wrote: > > > Hi! > > > > > >> 1) I don't see any notion of event notification on FD exception - e.g. > >> socket close. > >> There are some words for buffer events, but nothing for r

  1   2   >