File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 75
75
76
76
prepare_httpd () {
77
77
mkdir -p " $HTTPD_DOCUMENT_ROOT_PATH "
78
+ cp " $TEST_PATH " /passwd " $HTTPD_ROOT_PATH "
78
79
79
80
ln -s " $LIB_HTTPD_MODULE_PATH " " $HTTPD_ROOT_PATH /modules"
80
81
81
82
if test -n " $LIB_HTTPD_SSL "
82
83
then
83
84
HTTPD_URL=https://127.0.0.1:$LIB_HTTPD_PORT
85
+ AUTH_HTTPD_URL=https://user%40host:user%
[email protected] :
$LIB_HTTPD_PORT
84
86
85
87
RANDFILE_PATH=" $HTTPD_ROOT_PATH " /.rnd openssl req \
86
88
-config " $TEST_PATH /ssl.cnf" \
@@ -92,6 +94,7 @@ prepare_httpd() {
92
94
HTTPD_PARA=" $HTTPD_PARA -DSSL"
93
95
else
94
96
HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
97
+ AUTH_HTTPD_URL=http://user%40host:user%
[email protected] :
$LIB_HTTPD_PORT
95
98
fi
96
99
97
100
if test -n " $LIB_HTTPD_DAV " -o -n " $LIB_HTTPD_SVN "
Original file line number Diff line number Diff line change @@ -17,8 +17,30 @@ ErrorLog error.log
17
17
<IfModule !mod_env.c>
18
18
LoadModule env_module modules/mod_env.so
19
19
</IfModule>
20
+ <IfModule !mod_version.c>
21
+ LoadModule version_module modules/mod_version.so
22
+ </IfModule>
23
+
24
+ <IfVersion < 2.1>
25
+ <IfModule !mod_auth.c>
26
+ LoadModule auth_module modules/mod_auth.so
27
+ </IfModule>
28
+ </IfVersion>
29
+
30
+ <IfVersion >= 2.1>
31
+ <IfModule !mod_auth_basic.c>
32
+ LoadModule auth_basic_module modules/mod_auth_basic.so
33
+ </IfModule>
34
+ <IfModule !mod_authn_file.c>
35
+ LoadModule authn_file_module modules/mod_authn_file.so
36
+ </IfModule>
37
+ <IfModule !mod_authz_user.c>
38
+ LoadModule authz_user_module modules/mod_authz_user.so
39
+ </IfModule>
40
+ </IfVersion>
20
41
21
42
Alias /dumb/ www/
43
+ Alias /auth/ www/auth/
22
44
23
45
<Location /smart/>
24
46
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
@@ -48,6 +70,13 @@ SSLMutex file:ssl_mutex
48
70
SSLEngine On
49
71
</IfDefine>
50
72
73
+ <Location /auth/>
74
+ AuthType Basic
75
+ AuthName "git-auth"
76
+ AuthUserFile passwd
77
+ Require valid-user
78
+ </Location>
79
+
51
80
<IfDefine DAV>
52
81
LoadModule dav_module modules/mod_dav.so
53
82
LoadModule dav_fs_module modules/mod_dav_fs.so
Original file line number Diff line number Diff line change
1
+ user@host:nKpa8pZUHx/ic
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ test_expect_success 'clone http repository' '
34
34
test_cmp file clone/file
35
35
'
36
36
37
+ test_expect_failure ' clone http repository with authentication' '
38
+ mkdir "$HTTPD_DOCUMENT_ROOT_PATH/auth/" &&
39
+ cp -Rf "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" "$HTTPD_DOCUMENT_ROOT_PATH/auth/repo.git" &&
40
+ git clone $AUTH_HTTPD_URL/auth/repo.git clone-auth &&
41
+ test_cmp file clone-auth/file
42
+ '
43
+
37
44
test_expect_success ' fetch changes via http' '
38
45
echo content >>file &&
39
46
git commit -a -m two &&
You can’t perform that action at this time.
0 commit comments