3 test_description
='test git-http-backend-noserver'
6 HTTPD_DOCUMENT_ROOT_PATH
="$TRASH_DIRECTORY"
10 QUERY_STRING
="${1#*\?}" \
11 GIT_PROJECT_ROOT
="$HTTPD_DOCUMENT_ROOT_PATH" \
12 PATH_INFO
="${1%%\?*}" \
13 git http-backend
>act.out
2>act.err
17 REQUEST_METHOD
="GET" && export REQUEST_METHOD
&&
18 run_backend
"/repo.git/$1" &&
19 unset REQUEST_METHOD
&&
20 if ! grep "Status" act.out
>act
22 printf "Status: 200 OK\r\n" >act
24 printf "Status: $2\r\n" >exp
&&
29 REQUEST_METHOD
="POST" && export REQUEST_METHOD
&&
30 CONTENT_TYPE
="application/x-$1-request" && export CONTENT_TYPE
&&
31 run_backend
"/repo.git/$1" "$2" &&
32 unset REQUEST_METHOD
&&
34 if ! grep "Status" act.out
>act
36 printf "Status: 200 OK\r\n" >act
38 printf "Status: $3\r\n" >exp
&&
46 .
"$TEST_DIRECTORY"/t556x_common
49 REQUEST_METHOD
="GET" && export REQUEST_METHOD
&&
54 echo "fatal: '$2': aliased" >exp.err
&&
55 test_cmp exp.err act.err
60 test_expect_success
'http-backend blocks bad PATH_INFO' '
61 config http.getanyfile true &&
63 expect_aliased 0 /repo.git/HEAD &&
65 expect_aliased 1 /repo.git/../HEAD &&
66 expect_aliased 1 /../etc/passwd &&
67 expect_aliased 1 ../etc/passwd &&
68 expect_aliased 1 /etc//passwd &&
69 expect_aliased 1 /etc/./passwd &&
70 expect_aliased 1 //domain/data.txt