File tree Expand file tree Collapse file tree 4 files changed +65
-0
lines changed Expand file tree Collapse file tree 4 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 25
25
# LIB_HTTPD_DAV enable DAV
26
26
# LIB_HTTPD_SVN enable SVN at given location (e.g. "svn")
27
27
# LIB_HTTPD_SSL enable SSL
28
+ # LIB_HTTPD_PROXY enable proxy
28
29
#
29
30
# Copyright (c) 2008 Clemens Buchacher <[email protected] >
30
31
#
@@ -133,6 +134,7 @@ install_script () {
133
134
prepare_httpd () {
134
135
mkdir -p " $HTTPD_DOCUMENT_ROOT_PATH "
135
136
cp " $TEST_PATH " /passwd " $HTTPD_ROOT_PATH "
137
+ cp " $TEST_PATH " /proxy-passwd " $HTTPD_ROOT_PATH "
136
138
install_script incomplete-length-upload-pack-v2-http.sh
137
139
install_script incomplete-body-upload-pack-v2-http.sh
138
140
install_script error-no-report.sh
@@ -176,6 +178,11 @@ prepare_httpd() {
176
178
export LIB_HTTPD_SVN LIB_HTTPD_SVNPATH
177
179
fi
178
180
fi
181
+
182
+ if test -n " $LIB_HTTPD_PROXY "
183
+ then
184
+ HTTPD_PARA=" $HTTPD_PARA -DPROXY"
185
+ fi
179
186
}
180
187
181
188
enable_http2 () {
Original file line number Diff line number Diff line change @@ -47,6 +47,22 @@ Protocols h2c
47
47
LoadModule authz_host_module modules/mod_authz_host.so
48
48
</IfModule>
49
49
50
+ <IfDefine PROXY>
51
+ <IfModule !mod_proxy.c>
52
+ LoadModule proxy_module modules/mod_proxy.so
53
+ </IfModule>
54
+ <IfModule !mod_proxy_http.c>
55
+ LoadModule proxy_http_module modules/mod_proxy_http.so
56
+ </IfModule>
57
+ ProxyRequests On
58
+ <Proxy "*">
59
+ AuthType Basic
60
+ AuthName "proxy-auth"
61
+ AuthUserFile proxy-passwd
62
+ Require valid-user
63
+ </Proxy>
64
+ </IfDefine>
65
+
50
66
<IfModule !mod_authn_core.c>
51
67
LoadModule authn_core_module modules/mod_authn_core.so
52
68
</IfModule>
Original file line number Diff line number Diff line change
1
+ proxuser:2x7tAukjAED5M
Original file line number Diff line number Diff line change
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
+ 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
+ grep -i "Proxy-Authorization: Basic <redacted>" 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
+ test_done
You can’t perform that action at this time.
0 commit comments