Commit b117721dd8aa039e074c6bd46b18a526ac9cb2f3

Carlos Martín Nieto 2015-07-29T21:23:56

proxy: use poxy to test our Windows proxy support

diff --git a/appveyor.yml b/appveyor.yml
index 5ba8aaa..50152ad 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -19,6 +19,7 @@ environment:
 cache:
 - i686-4.9.2-release-win32-sjlj-rt_v3-rev1.7z
 - x86_64-4.9.2-release-win32-seh-rt_v3-rev1.7z
+
 build_script:
 - ps: |
     mkdir build
@@ -26,6 +27,7 @@ build_script:
     if ($env:GENERATOR -ne "MSYS Makefiles") {
       cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON -D MSVC_CRTDBG=ON .. -G"$env:GENERATOR"
       cmake --build . --config Debug
+      Invoke-WebRequest https://github.com/ethomson/poxyproxy/releases/download/v0.1.0/poxyproxy-0.1.0.jar -OutFile poxyproxy.jar
     }
 - cmd: |
     if "%GENERATOR%"=="MSYS Makefiles" (C:\MinGW\msys\1.0\bin\sh --login /c/projects/libgit2/script/appveyor-mingw.sh)
@@ -36,3 +38,11 @@ test_script:
     $env:GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
     $env:GITTEST_REMOTE_USER="libgit2test"
     ctest -V -R libgit2_clar-cred_callback
+    Start-Job { java -jar $Env:APPVEYOR_BUILD_FOLDER\build\poxyproxy.jar -d --port 8080 --credentials foo:bar }
+    ctest -V .
+    $env:GITTEST_REMOTE_PROXY_URL = "http://foo:bar@localhost:8080/"
+    .\Debug\libgit2_clar.exe -sonline::clone::proxy_credentials_in_url
+    $env:GITTEST_REMOTE_PROXY_URL = "http://localhost:8080/"
+    $env:GITTEST_REMOTE_PROXY_USER = "foo"
+    $env:GITTEST_REMOTE_PROXY_PASS = "bar"
+    .\Debug\libgit2_clar.exe -sonline::clone::proxy_credentials_request
diff --git a/src/transports/smart.c b/src/transports/smart.c
index a78b572..11b4b09 100644
--- a/src/transports/smart.c
+++ b/src/transports/smart.c
@@ -444,6 +444,7 @@ static void git_smart__free(git_transport *transport)
 		git_pkt_free(p);
 
 	git_vector_free(refs);
+	git__free(t->proxy.url);
 
 	git_strarray_free(&t->custom_headers);
 
diff --git a/tests/online/clone.c b/tests/online/clone.c
index cc4d2fe..d2a5928 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -693,7 +693,6 @@ void test_online_clone__proxy_credentials_in_url(void)
 
 	g_options.fetch_opts.proxy_opts.type = GIT_PROXY_HTTP;
 	g_options.fetch_opts.proxy_opts.url = _remote_proxy_url;
-	g_options.fetch_opts.proxy_opts.credentials = proxy_creds;
 	called_proxy_creds = 0;
 	cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options));
 	cl_assert(called_proxy_creds == 0);