Commit c4cba4e96ae8aec1d71af1ab57d319362f5c3eb7

Patrick Steinhardt 2016-08-17T11:00:05

transports: http: reset `connected` flag when re-connecting transport 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`.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/transports/http.c b/src/transports/http.c
index 30520a0..efa6383 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -599,6 +599,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) {