]> granicus.if.org Git - libevent/commit
Avoid missed-request bug when entire http request arrives before data is flushed
authorNick Mathewson <nickm@torproject.org>
Tue, 26 Oct 2010 01:53:15 +0000 (21:53 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 26 Oct 2010 01:53:15 +0000 (21:53 -0400)
commit74c0e862984edc5585b34abce9e6decd6aa05969
treedb92a16c770a8a59ace95db86cea450594af298d
parent8e342e563060a5dfc4c33bd46a2a6819a5d5b2f7
Avoid missed-request bug when entire http request arrives before data is flushed

The trigger for starting to read the first line of a request used to
be, "When data has arrived and we're looking for the first line."
But that's not good enough: if the entire next request gets read
into our bufev->inbuf while we're still processing the current
request, we'll never see any more data arrive, and so will never
process it.

So the fix is to make sure that whenever we hit evhttp_send_done, we
call evhttp_read_cb.  We can't call it directly, though, since
evhttp_send_done is reachable from the user API, and evhttp_read_cb
can invoke user functions, and we don't want to force everyone to
have reentrant callbacks.  So, we use a deferred_cb.

Found by Ivan Andropov.  This is bug 3008344.
http-internal.h
http.c