]> granicus.if.org Git - libevent/commitdiff
evhttp: Fix failure to send all output data for POST/PUT requests
authorJohn Ohl <john@collabriasoftware.com>
Mon, 24 Nov 2014 07:32:23 +0000 (02:32 -0500)
committerJohn Ohl <john@collabriasoftware.com>
Mon, 24 Nov 2014 07:32:23 +0000 (02:32 -0500)
http.c

diff --git a/http.c b/http.c
index 3941d1790063328240e1cb4ceb65e07f41066093..24980688fb1d500fb9cb5dc509944414e845043c 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1108,6 +1108,9 @@ evhttp_write_connectioncb(struct evhttp_connection *evcon, void *arg)
 
        EVUTIL_ASSERT(evcon->state == EVCON_WRITING);
 
+       /* We need to wait until we've written all of our output data before we can continue */
+       if (evbuffer_get_length(bufferevent_get_output(evcon->bufev)) > 0) { return; }
+
        /* We are done writing our header and are now expecting the response */
        req->kind = EVHTTP_RESPONSE;