]> git.proxmox.com Git - libgit2.git/commitdiff
proxy: don't specify the protocol in the type
authorCarlos Martín Nieto <cmn@dwim.me>
Mon, 14 Mar 2016 16:36:04 +0000 (17:36 +0100)
committerCarlos Martín Nieto <cmn@dwim.me>
Tue, 19 Apr 2016 11:54:19 +0000 (13:54 +0200)
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.

include/git2/proxy.h
src/transports/http.c
src/transports/winhttp.c
tests/online/clone.c

index b45b55b3b595a830d536bd6f9b14b65f3bc18373..dcd61563372d7791d24f5909534a136ba667ab08 100644 (file)
@@ -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;
 
 /**
index 03a16da981805289bb976017e1ddf77b42ddf2e8..7bb3374a0d75160e155080870ff80b07af56cf21 100644 (file)
@@ -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);
index d9f38c8269b007f444f3ec5ce463629c217e0e31..580c3b91be4a33effffb502687e7f5dd699fa9dc 100644 (file)
@@ -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);
        }
index d2a5928dac6f6a5e25c492086478672ea9f54efd..0fc8d427120d4e70cd804c2fad316c03149e7b62 100644 (file)
@@ -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));