]> git.proxmox.com Git - libgit2.git/commitdiff
transports: http: reset `connected` flag when re-connecting transport
authorPatrick Steinhardt <ps@pks.im>
Wed, 17 Aug 2016 09:00:05 +0000 (11:00 +0200)
committerCarlos Martín Nieto <cmn@dwim.me>
Sat, 1 Oct 2016 15:41:28 +0000 (17:41 +0200)
When calling `http_connect` on a subtransport whose stream is already
connected, we first close the stream in case no keep-alive is in use.
When doing so, we do not reset the transport's connection state,
though. Usually, this will do no harm in case the subsequent connect
will succeed. But when the connection fails we are left with a
substransport which is tagged as connected but which has no valid
stream attached.

Fix the issue by resetting the subtransport's connected-state when
closing its stream in `http_connect`.

src/transports/http.c

index 4bf1d91bf99b4e9c5886346fd58ed144c6ad7798..f0efd956a8fd1d55f721671607b8920bb95707d7 100644 (file)
@@ -569,6 +569,7 @@ static int http_connect(http_subtransport *t)
                git_stream_close(t->io);
                git_stream_free(t->io);
                t->io = NULL;
+               t->connected = 0;
        }
 
        if (t->connection_data.use_ssl) {