Skip to content

Commit 8e76212

Browse files
committed
httpproxy: move empty string test above config
The configuration change will override the environment variable, so the environment variable check needs to come first.
1 parent 31e32dd commit 8e76212

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/remote/httpproxy.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ void test_remote_httpproxy__env(void)
112112
orig_no_proxy = cl_getenv("NO_PROXY");
113113
orig_proxies_need_reset = 1;
114114

115+
/* Clear everything for a fresh start */
116+
cl_setenv("HTTP_PROXY", NULL);
117+
cl_setenv("HTTPS_PROXY", NULL);
118+
cl_setenv("NO_PROXY", NULL);
119+
115120
/* HTTP proxy is ignored for HTTPS */
116121
cl_setenv("HTTP_PROXY", "http://localhost:9/");
117122
assert_proxy_is(NULL);
@@ -133,11 +138,11 @@ void test_remote_httpproxy__env(void)
133138
cl_setenv("NO_PROXY", "github.dev,github.com,github.foo");
134139
assert_proxy_is(NULL);
135140

141+
cl_setenv("HTTPS_PROXY", "");
142+
assert_proxy_is(NULL);
143+
136144
/* configuration overrides environment variables */
145+
cl_setenv("HTTPS_PROXY", "http://localhost:10/");
137146
cl_setenv("NO_PROXY", "github.none");
138147
assert_config_match("http.https://github.com.proxy", "http://localhost:11/");
139-
140-
/* empty env behaves like unset env */
141-
cl_setenv("HTTPS_PROXY", "");
142-
assert_proxy_is(NULL);
143148
}

0 commit comments

Comments
 (0)