proxy: don't specify the protocol in the type We leave this up to the scheme in the url field. The type should only tell us about whether we want a proxy and whether we want to auto-detect it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
diff --git a/include/git2/proxy.h b/include/git2/proxy.h
index b45b55b..dcd6156 100644
--- a/include/git2/proxy.h
+++ b/include/git2/proxy.h
@@ -18,6 +18,9 @@ GIT_BEGIN_DECL
typedef enum {
/**
* Do not attempt to connect through a proxy
+ *
+ * If built against lbicurl, it itself may attempt to connect
+ * to a proxy if the environment variables specify it.
*/
GIT_PROXY_NONE,
/**
@@ -25,17 +28,9 @@ typedef enum {
*/
GIT_PROXY_AUTO,
/**
- * Connect through a HTTP proxy
- */
- GIT_PROXY_HTTP,
- /**
- * Connect through a SOCKS v4 proxy
- */
- GIT_PROXY_SOCKS4,
- /**
- * Connect through a SOCKS v5 proxy
+ * Connect via the URL given in the options
*/
- GIT_PROXY_SOCKS5,
+ GIT_PROXY_SPECIFIED,
} git_proxy_t;
/**
diff --git a/src/transports/http.c b/src/transports/http.c
index 03a16da..7bb3374 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -575,7 +575,7 @@ static int apply_proxy_config(http_subtransport *t)
if ((error = git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &url)) < 0)
return error;
- opts.type = GIT_PROXY_HTTP;
+ opts.type = GIT_PROXY_SPECIFIED;
opts.url = url;
error = git_stream_set_proxy(t->io, &opts);
git__free(url);
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index d9f38c8..580c3b9 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -381,7 +381,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
if (git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &proxy_url) < 0)
goto on_error;
}
- else if (proxy_opts->type == GIT_PROXY_HTTP) {
+ else if (proxy_opts->type == GIT_PROXY_SPECIFIED) {
proxy_url = git__strdup(proxy_opts->url);
GITERR_CHECK_ALLOC(proxy_url);
}
diff --git a/tests/online/clone.c b/tests/online/clone.c
index d2a5928..0fc8d42 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -678,7 +678,7 @@ void test_online_clone__proxy_credentials_request(void)
if (!_remote_proxy_url || !_remote_proxy_user || !_remote_proxy_pass)
cl_skip();
- g_options.fetch_opts.proxy_opts.type = GIT_PROXY_HTTP;
+ g_options.fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED;
g_options.fetch_opts.proxy_opts.url = _remote_proxy_url;
g_options.fetch_opts.proxy_opts.credentials = proxy_creds;
called_proxy_creds = 0;
@@ -691,7 +691,7 @@ void test_online_clone__proxy_credentials_in_url(void)
if (!_remote_proxy_url)
cl_skip();
- g_options.fetch_opts.proxy_opts.type = GIT_PROXY_HTTP;
+ g_options.fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED;
g_options.fetch_opts.proxy_opts.url = _remote_proxy_url;
called_proxy_creds = 0;
cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options));