Skip to content

Commit 393dd49

Browse files
committed
Merge branch 'v1.7_proxy' into maint/v1.7
2 parents 0ddc077 + 38a3a37 commit 393dd49

File tree

8 files changed

+1172
-177
lines changed

8 files changed

+1172
-177
lines changed

src/libgit2/transports/http.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,15 @@ static int lookup_proxy(
335335
}
336336

337337
if (!proxy ||
338-
(error = git_net_url_parse(&transport->proxy.url, proxy)) < 0)
338+
(error = git_net_url_parse_http(&transport->proxy.url, proxy)) < 0)
339339
goto done;
340340

341+
if (!git_net_url_valid(&transport->proxy.url)) {
342+
git_error_set(GIT_ERROR_HTTP, "invalid URL: '%s'", proxy);
343+
error = -1;
344+
goto done;
345+
}
346+
341347
*out_use = true;
342348

343349
done:

src/libgit2/transports/httpclient.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,11 @@ GIT_INLINE(int) server_setup_from_url(
837837
git_http_server *server,
838838
git_net_url *url)
839839
{
840+
GIT_ASSERT_ARG(url);
841+
GIT_ASSERT_ARG(url->scheme);
842+
GIT_ASSERT_ARG(url->host);
843+
GIT_ASSERT_ARG(url->port);
844+
840845
if (!server->url.scheme || strcmp(server->url.scheme, url->scheme) ||
841846
!server->url.host || strcmp(server->url.host, url->host) ||
842847
!server->url.port || strcmp(server->url.port, url->port)) {

src/libgit2/transports/winhttp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,10 @@ static int winhttp_stream_connect(winhttp_stream *s)
443443

444444
git_net_url_dispose(&t->proxy.url);
445445

446-
if ((error = git_net_url_parse(&t->proxy.url, proxy_url)) < 0)
446+
if ((error = git_net_url_parse_http(&t->proxy.url, proxy_url)) < 0)
447447
goto on_error;
448448

449-
if (strcmp(t->proxy.url.scheme, "http") != 0 && strcmp(t->proxy.url.scheme, "https") != 0) {
449+
if (!git_net_url_valid(&t->proxy.url)) {
450450
git_error_set(GIT_ERROR_HTTP, "invalid URL: '%s'", proxy_url);
451451
error = -1;
452452
goto on_error;

0 commit comments

Comments
 (0)