Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
5a13d4ca
Commit
5a13d4ca
authored
Jul 19, 2023
by
lmcglash
Committed by
Edward Thomson
Aug 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate proxy URL on Windows.
parent
402f63a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
src/libgit2/transports/http.c
+4
-7
src/libgit2/transports/winhttp.c
+1
-1
tests/libgit2/online/clone.c
+2
-2
No files found.
src/libgit2/transports/http.c
View file @
5a13d4ca
...
@@ -334,16 +334,13 @@ static int lookup_proxy(
...
@@ -334,16 +334,13 @@ static int lookup_proxy(
return
0
;
return
0
;
}
}
if
(
!
proxy
)
if
(
!
proxy
||
goto
done
;
(
error
=
git_net_url_parse
(
&
transport
->
proxy
.
url
,
proxy
))
<
0
)
if
((
error
=
git_net_url_parse
(
&
transport
->
proxy
.
url
,
proxy
)
<
0
))
goto
done
;
goto
done
;
if
(
!
git_net_url_valid
(
&
transport
->
proxy
.
url
))
{
if
(
!
git_net_url_valid
(
&
transport
->
proxy
.
url
))
{
git_error_set
(
GIT_ERROR_HTTP
,
"invalid
proxy url: %s
"
,
proxy
);
git_error_set
(
GIT_ERROR_HTTP
,
"invalid
URL: '%s'
"
,
proxy
);
error
=
GIT_EINVALIDSPEC
;
error
=
-
1
;
goto
done
;
goto
done
;
}
}
...
...
src/libgit2/transports/winhttp.c
View file @
5a13d4ca
...
@@ -446,7 +446,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
...
@@ -446,7 +446,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
if
((
error
=
git_net_url_parse
(
&
t
->
proxy
.
url
,
proxy_url
))
<
0
)
if
((
error
=
git_net_url_parse
(
&
t
->
proxy
.
url
,
proxy_url
))
<
0
)
goto
on_error
;
goto
on_error
;
if
(
strcmp
(
t
->
proxy
.
url
.
scheme
,
"http"
)
!=
0
&&
strcmp
(
t
->
proxy
.
url
.
scheme
,
"https"
)
!=
0
)
{
if
(
!
git_net_url_valid
(
&
t
->
proxy
.
url
)
)
{
git_error_set
(
GIT_ERROR_HTTP
,
"invalid URL: '%s'"
,
proxy_url
);
git_error_set
(
GIT_ERROR_HTTP
,
"invalid URL: '%s'"
,
proxy_url
);
error
=
-
1
;
error
=
-
1
;
goto
on_error
;
goto
on_error
;
...
...
tests/libgit2/online/clone.c
View file @
5a13d4ca
...
@@ -975,10 +975,10 @@ void test_online_clone__proxy_invalid_url(void)
...
@@ -975,10 +975,10 @@ void test_online_clone__proxy_invalid_url(void)
g_options
.
fetch_opts
.
proxy_opts
.
certificate_check
=
proxy_cert_cb
;
g_options
.
fetch_opts
.
proxy_opts
.
certificate_check
=
proxy_cert_cb
;
g_options
.
fetch_opts
.
proxy_opts
.
url
=
"noschemeorport"
;
g_options
.
fetch_opts
.
proxy_opts
.
url
=
"noschemeorport"
;
cl_git_fail
_with
(
GIT_EINVALIDSPEC
,
git_clone
(
&
g_repo
,
"http://github.com/libgit2/TestGitRepository"
,
"./foo"
,
&
g_options
));
cl_git_fail
(
git_clone
(
&
g_repo
,
"http://github.com/libgit2/TestGitRepository"
,
"./foo"
,
&
g_options
));
g_options
.
fetch_opts
.
proxy_opts
.
url
=
"noscheme:8080"
;
g_options
.
fetch_opts
.
proxy_opts
.
url
=
"noscheme:8080"
;
cl_git_fail
_with
(
GIT_EINVALIDSPEC
,
git_clone
(
&
g_repo
,
"http://github.com/libgit2/TestGitRepository"
,
"./foo"
,
&
g_options
));
cl_git_fail
(
git_clone
(
&
g_repo
,
"http://github.com/libgit2/TestGitRepository"
,
"./foo"
,
&
g_options
));
}
}
void
test_online_clone__proxy_credentials_request
(
void
)
void
test_online_clone__proxy_credentials_request
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment