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 7575
7676prepare_httpd () {
7777 mkdir -p " $HTTPD_DOCUMENT_ROOT_PATH "
78+ cp " $TEST_PATH " /passwd " $HTTPD_ROOT_PATH "
7879
7980 ln -s " $LIB_HTTPD_MODULE_PATH " " $HTTPD_ROOT_PATH /modules"
8081
8182 if test -n " $LIB_HTTPD_SSL "
8283 then
8384 HTTPD_URL=https://127.0.0.1:$LIB_HTTPD_PORT
85+ AUTH_HTTPD_URL=https://user%40host:user%40host@127.0.0.1:$LIB_HTTPD_PORT
8486
8587 RANDFILE_PATH=" $HTTPD_ROOT_PATH " /.rnd openssl req \
8688 -config " $TEST_PATH /ssl.cnf" \
@@ -92,6 +94,7 @@ prepare_httpd() {
9294 HTTPD_PARA=" $HTTPD_PARA -DSSL"
9395 else
9496 HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
97+ AUTH_HTTPD_URL=http://user%40host:user%40host@127.0.0.1:$LIB_HTTPD_PORT
9598 fi
9699
97100 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
1717<IfModule !mod_env.c>
1818 LoadModule env_module modules/mod_env.so
1919</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>
2041
2142Alias /dumb/ www/
43+ Alias /auth/ www/auth/
2244
2345<Location /smart/>
2446 SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
@@ -48,6 +70,13 @@ SSLMutex file:ssl_mutex
4870SSLEngine On
4971</IfDefine>
5072
73+ <Location /auth/>
74+ AuthType Basic
75+ AuthName "git-auth"
76+ AuthUserFile passwd
77+ Require valid-user
78+ </Location>
79+
5180<IfDefine DAV>
5281 LoadModule dav_module modules/mod_dav.so
5382 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' '
3434 test_cmp file clone/file
3535'
3636
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+
3744test_expect_success ' fetch changes via http' '
3845 echo content >>file &&
3946 git commit -a -m two &&
You can’t perform that action at this time.
0 commit comments