Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t5564-http-proxy.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t5564-http-proxy.sh` 111 lines ยท 3532 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description="test fetching through http proxy" 4 5 . ./test-lib.sh 6 . "$TEST_DIRECTORY"/lib-httpd.sh 7 8 LIB_HTTPD_PROXY=1 9 start_httpd 10 11 test_expect_success 'setup repository' ' 12 test_commit foo && 13 git init --bare "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && 14 git push --mirror "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" 15 ' 16 17 setup_askpass_helper 18 19 # sanity check that our test setup is correctly using proxy 20 test_expect_success 'proxy requires password' ' 21 test_config_global http.proxy $HTTPD_DEST && 22 test_must_fail git clone $HTTPD_URL/smart/repo.git 2>err && 23 test_grep "error.*407" err 24 ' 25 26 test_expect_success 'clone through proxy with auth' ' 27 test_when_finished "rm -rf clone" && 28 test_config_global http.proxy http://proxuser:proxpass@$HTTPD_DEST && 29 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone && 30 test_grep -i "Proxy-Authorization: Basic " trace 31 ' 32 33 test_expect_success 'clone can prompt for proxy password' ' 34 test_when_finished "rm -rf clone" && 35 test_config_global http.proxy http://proxuser@$HTTPD_DEST && 36 set_askpass nobody proxpass && 37 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone && 38 expect_askpass pass proxuser 39 ' 40 41 start_socks() { 42 mkfifo socks_output && 43 ( 44 "$PERL_PATH" "$TEST_DIRECTORY/socks4-proxy.pl" "$1" >socks_output & 45 echo $! > "$TRASH_DIRECTORY/socks.pid" 46 ) && 47 read line err && 85 test_grep -i "SOCKS4 request granted" trace 86 } || 87 old_libcurl_error err 88 } 89 ' 90 91 test_expect_success 'Unix socket requires socks*:' - <<\EOT 92 ! git clone -c http.proxy=localhost/path https://example.com/repo.git 2>err && { 93 test_grep -Fx "fatal: Invalid proxy URL 'localhost/path': only SOCKS proxies support paths" err || 94 old_libcurl_error err 95 } 96 EOT 97 98 test_expect_success 'Unix socket requires localhost' - <<\EOT 99 ! git clone -c http.proxy=socks4://127.0.0.1/path https://example.com/repo.git 2>err && { 100 test_grep -Fx "fatal: Invalid proxy URL 'socks4://127.0.0.1/path': host must be localhost if a path is present" err || 101 old_libcurl_error err 102 } 103 EOT 104 105 test_expect_success 'unknown proxy scheme is rejected' ' 106 test_must_fail git clone -c http.proxy=htpp://127.0.0.1 \ 107 https://example.com/repo.git 2>err && 108 test_grep "unsupported proxy scheme '\''htpp'\''" err 109 ' 110 111 test_done