]> granicus.if.org Git - libevent/commitdiff
http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else)
authorAzat Khuzhin <azat@libevent.org>
Tue, 19 May 2020 08:45:43 +0000 (11:45 +0300)
committerAzat Khuzhin <azat@libevent.org>
Tue, 19 May 2020 08:46:21 +0000 (11:46 +0300)
Refs: #182

http.c

diff --git a/http.c b/http.c
index 15aac6619bc88125b9ca613fac2ff1d157d121d9..142c2e73ee54e76cf23546e9d58e8253eced0b07 100644 (file)
--- a/http.c
+++ b/http.c
@@ -877,6 +877,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