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
bf7d3888
Unverified
Commit
bf7d3888
authored
Feb 23, 2023
by
Edward Thomson
Committed by
GitHub
Feb 23, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6498 from libgit2/ethomson/httpproxy_env_tests
tests: always unset HTTP_PROXY before starting tests
parents
c9387a61
80016e0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
21 deletions
+15
-21
tests/libgit2/remote/httpproxy.c
+15
-21
No files found.
tests/libgit2/remote/httpproxy.c
View file @
bf7d3888
...
...
@@ -6,7 +6,6 @@
static
git_repository
*
repo
;
static
git_net_url
url
=
GIT_NET_URL_INIT
;
static
int
orig_proxies_need_reset
=
0
;
static
char
*
orig_http_proxy
=
NULL
;
static
char
*
orig_https_proxy
=
NULL
;
static
char
*
orig_no_proxy
=
NULL
;
...
...
@@ -21,20 +20,25 @@ void test_remote_httpproxy__initialize(void)
git_remote_free
(
remote
);
orig_proxies_need_reset
=
0
;
/* Clear everything for a fresh start */
orig_http_proxy
=
cl_getenv
(
"HTTP_PROXY"
);
orig_https_proxy
=
cl_getenv
(
"HTTPS_PROXY"
);
orig_no_proxy
=
cl_getenv
(
"NO_PROXY"
);
cl_setenv
(
"HTTP_PROXY"
,
NULL
);
cl_setenv
(
"HTTPS_PROXY"
,
NULL
);
cl_setenv
(
"NO_PROXY"
,
NULL
);
}
void
test_remote_httpproxy__cleanup
(
void
)
{
if
(
orig_proxies_need_reset
)
{
cl_setenv
(
"HTTP_PROXY"
,
orig_http_proxy
);
cl_setenv
(
"HTTPS_PROXY"
,
orig_https_proxy
);
cl_setenv
(
"NO_PROXY"
,
orig_no_proxy
);
git__free
(
orig_http_proxy
);
git__free
(
orig_https_proxy
);
git__free
(
orig_no_proxy
);
}
cl_setenv
(
"HTTP_PROXY"
,
orig_http_proxy
);
cl_setenv
(
"HTTPS_PROXY"
,
orig_https_proxy
);
cl_setenv
(
"NO_PROXY"
,
orig_no_proxy
);
git__free
(
orig_http_proxy
);
git__free
(
orig_https_proxy
);
git__free
(
orig_no_proxy
);
git_net_url_dispose
(
&
url
);
cl_git_sandbox_cleanup
();
...
...
@@ -145,16 +149,6 @@ void test_remote_httpproxy__config_overrides_detached_remote(void)
void
test_remote_httpproxy__env
(
void
)
{
orig_http_proxy
=
cl_getenv
(
"HTTP_PROXY"
);
orig_https_proxy
=
cl_getenv
(
"HTTPS_PROXY"
);
orig_no_proxy
=
cl_getenv
(
"NO_PROXY"
);
orig_proxies_need_reset
=
1
;
/* Clear everything for a fresh start */
cl_setenv
(
"HTTP_PROXY"
,
NULL
);
cl_setenv
(
"HTTPS_PROXY"
,
NULL
);
cl_setenv
(
"NO_PROXY"
,
NULL
);
/* HTTP proxy is ignored for HTTPS */
cl_setenv
(
"HTTP_PROXY"
,
"http://localhost:9/"
);
assert_proxy_is
(
NULL
);
...
...
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