Skip to content

Commit 9ad9636

Browse files
committed
smart transport: only clear url on hard reset
After creating a transport for a server, we expect to be able to call `connect`, then invoke subsequent `action` calls. We provide the URL to these `action` calls, although our built-in transports happen to ignore it since they've already parsed it into an internal format that they intend to use (`gitno_connection_data`). In ca2eb46, we began clearing the URL field after a connection, meaning that subsequent calls to transport `action` callbacks would get a NULL URL, which went undetected since the builtin transports ignore the URL when they're already connected (instead of re-parsing it into an internal format). Downstream custom transport implementations (eg, LibGit2Sharp) did notice this change, however. Since `reset_stream` is called even when we're not closing the subtransport, update to only clear the URL when we're closing the subtransport. This ensures that `action` calls will get the correct URL information even after a connection.
1 parent fa7aba7 commit 9ad9636

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/transports/smart.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ GIT_INLINE(int) git_smart__reset_stream(transport_smart *t, bool close_subtransp
4545
t->current_stream = NULL;
4646
}
4747

48-
if (t->url) {
48+
if (close_subtransport) {
4949
git__free(t->url);
5050
t->url = NULL;
51-
}
5251

53-
if (close_subtransport &&
54-
t->wrapped->close(t->wrapped) < 0)
55-
return -1;
52+
if (t->wrapped->close(t->wrapped) < 0)
53+
return -1;
54+
}
5655

5756
return 0;
5857
}

0 commit comments

Comments
 (0)