3 test_description
='test git-http-backend-noserver'
6 HTTPD_DOCUMENT_ROOT_PATH
="$TRASH_DIRECTORY"
8 test_have_prereq MINGW
&& export GREP_OPTIONS
=-U
12 QUERY_STRING
="${1#*\?}" \
13 PATH_TRANSLATED
="$HTTPD_DOCUMENT_ROOT_PATH/${1%%\?*}" \
14 git http-backend
>act.out
2>act.err
18 REQUEST_METHOD
="GET" && export REQUEST_METHOD
&&
19 run_backend
"/repo.git/$1" &&
20 unset REQUEST_METHOD
&&
21 if ! grep "Status" act.out
>act
23 printf "Status: 200 OK\r\n" >act
25 printf "Status: $2\r\n" >exp
&&
30 REQUEST_METHOD
="POST" && export REQUEST_METHOD
&&
31 CONTENT_TYPE
="application/x-$1-request" && export CONTENT_TYPE
&&
32 run_backend
"/repo.git/$1" "$2" &&
33 unset REQUEST_METHOD
&&
35 if ! grep "Status" act.out
>act
37 printf "Status: 200 OK\r\n" >act
39 printf "Status: $3\r\n" >exp
&&
47 .
"$TEST_DIRECTORY"/t556x_common
50 REQUEST_METHOD
="GET" && export REQUEST_METHOD
&&
55 echo "fatal: '$2': aliased" >exp.err
&&
56 test_cmp exp.err act.err
61 test_expect_success
'http-backend blocks bad PATH_INFO' '
62 config http.getanyfile true &&
64 expect_aliased 0 /repo.git/HEAD &&
66 expect_aliased 1 /repo.git/../HEAD &&
67 expect_aliased 1 /../etc/passwd &&
68 expect_aliased 1 ../etc/passwd &&
69 expect_aliased 1 /etc//passwd &&
70 expect_aliased 1 /etc/./passwd &&
71 expect_aliased 1 //domain/data.txt