summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2020-05-19 11:45:43 +0300
committerAzat Khuzhin <azat@libevent.org>2020-06-28 21:35:11 +0300
commit1be25938b0431a182569088dd44d4fe77b4d909f (patch)
treec8a527632e0ea154ed2db3346b4a805a86116a64
parent8dc6468e7e0054906166f6fcb339a3e46f993918 (diff)
downloadlibevent-1be25938b0431a182569088dd44d4fe77b4d909f.tar.gz
http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else)
Refs: #182 (cherry picked from commit eee26deed38fc7a6b6780b54628b007a2810efcd)
-rw-r--r--http.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/http.c b/http.c
index 983f966d..4165de9d 100644
--- a/http.c
+++ b/http.c
@@ -782,6 +782,11 @@ evhttp_connection_fail_(struct evhttp_connection *evcon,
/* We are trying the next request that was queued on us */
if (TAILQ_FIRST(&evcon->requests) != NULL)
evhttp_connection_connect_(evcon);
+ else
+ if ((evcon->flags & EVHTTP_CON_OUTGOING) &&
+ (evcon->flags & EVHTTP_CON_AUTOFREE)) {
+ evhttp_connection_free(evcon);
+ }
/* The call to evhttp_connection_reset_ overwrote errno.
* Let's restore the original errno, so that the user's