3 test_description
='test git-http-backend'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 TEST_PASSES_SANITIZE_LEAK
=true
9 .
"$TEST_DIRECTORY"/lib-httpd.sh
11 if ! test_have_prereq CURL
; then
12 skip_all
='skipping raw http-backend tests, curl not available'
19 curl
--include "$HTTPD_URL/$SMART/repo.git/$1" >out
&&
25 echo "HTTP/1.1 $2" >exp
&&
30 curl
--include --data "$2" \
31 --header "Content-Type: application/x-$1-request" \
32 "$HTTPD_URL/smart/repo.git/$1" >out
&&
38 echo "HTTP/1.1 $3" >exp
&&
42 .
"$TEST_DIRECTORY"/t556x_common
44 grep '^[^#]' >exp
<<EOF
48 GET /smart/repo.git/refs/heads/main HTTP/1.1 404 -
50 ### getanyfile default
52 GET /smart/repo.git/HEAD HTTP/1.1 200
53 GET /smart/repo.git/info/refs HTTP/1.1 200
54 GET /smart/repo.git/objects/info/packs HTTP/1.1 200
55 GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
56 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
57 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
58 GET /smart/repo.git/$PACK_URL HTTP/1.1 200
59 GET /smart/repo.git/$IDX_URL HTTP/1.1 200
61 ### no git-daemon-export-ok
63 GET /smart_noexport/repo.git/HEAD HTTP/1.1 404 -
64 GET /smart_noexport/repo.git/info/refs HTTP/1.1 404 -
65 GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 404 -
66 GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 404 -
67 GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 404 -
68 GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 404 -
69 GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 404 -
70 GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 404 -
72 ### git-daemon-export-ok
74 GET /smart_noexport/repo.git/HEAD HTTP/1.1 200
75 GET /smart_noexport/repo.git/info/refs HTTP/1.1 200
76 GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 200
77 GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 200 -
78 GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 200 -
79 GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 200
80 GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 200
81 GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 200
85 GET /smart/repo.git/HEAD HTTP/1.1 200
86 GET /smart/repo.git/info/refs HTTP/1.1 200
87 GET /smart/repo.git/objects/info/packs HTTP/1.1 200
88 GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
89 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
90 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
91 GET /smart/repo.git/$PACK_URL HTTP/1.1 200
92 GET /smart/repo.git/$IDX_URL HTTP/1.1 200
96 GET /smart/repo.git/HEAD HTTP/1.1 403 -
97 GET /smart/repo.git/info/refs HTTP/1.1 403 -
98 GET /smart/repo.git/objects/info/packs HTTP/1.1 403 -
99 GET /smart/repo.git/objects/info/alternates HTTP/1.1 403 -
100 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 403 -
101 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 403 -
102 GET /smart/repo.git/$PACK_URL HTTP/1.1 403 -
103 GET /smart/repo.git/$IDX_URL HTTP/1.1 403 -
105 ### uploadpack default
107 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
108 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
112 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
113 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
117 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 403 -
118 POST /smart/repo.git/git-upload-pack HTTP/1.1 403 -
120 ### receivepack default
122 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
123 POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
127 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
128 POST /smart/repo.git/git-receive-pack HTTP/1.1 200 -
130 ### receivepack false
132 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
133 POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
135 test_expect_success
'server request log matches test results' '