]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5561-http-backend.sh
Doc: no midx and partial clone relation
[thirdparty/git.git] / t / t5561-http-backend.sh
CommitLineData
7f640b77
SP
1#!/bin/sh
2
3test_description='test git-http-backend'
028cb644 4GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
5export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7f640b77 7. ./test-lib.sh
7f640b77 8. "$TEST_DIRECTORY"/lib-httpd.sh
e9184b07
JK
9
10if ! test_have_prereq CURL; then
11 skip_all='skipping raw http-backend tests, curl not available'
12 test_done
13fi
14
7f640b77
SP
15start_httpd
16
7f640b77 17GET() {
fcd9d709 18 curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out &&
7f640b77
SP
19 tr '\015' Q <out |
20 sed '
21 s/Q$//
22 1q
23 ' >act &&
24 echo "HTTP/1.1 $2" >exp &&
25 test_cmp exp act
26}
27
28POST() {
29 curl --include --data "$2" \
30 --header "Content-Type: application/x-$1-request" \
fcd9d709 31 "$HTTPD_URL/smart/repo.git/$1" >out &&
7f640b77
SP
32 tr '\015' Q <out |
33 sed '
34 s/Q$//
35 1q
36 ' >act &&
37 echo "HTTP/1.1 $3" >exp &&
38 test_cmp exp act
39}
40
04481adf 41. "$TEST_DIRECTORY"/t556x_common
34b6cb8b 42
362d8b6e 43grep '^[^#]' >exp <<EOF
7f640b77 44
028cb644 45### refs/heads/main
7f640b77 46###
028cb644 47GET /smart/repo.git/refs/heads/main HTTP/1.1 404 -
7f640b77
SP
48
49### getanyfile default
50###
51GET /smart/repo.git/HEAD HTTP/1.1 200
52GET /smart/repo.git/info/refs HTTP/1.1 200
53GET /smart/repo.git/objects/info/packs HTTP/1.1 200
54GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
55GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
56GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
57GET /smart/repo.git/$PACK_URL HTTP/1.1 200
58GET /smart/repo.git/$IDX_URL HTTP/1.1 200
59
8b2bd7cd
TC
60### no git-daemon-export-ok
61###
62GET /smart_noexport/repo.git/HEAD HTTP/1.1 404 -
63GET /smart_noexport/repo.git/info/refs HTTP/1.1 404 -
64GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 404 -
65GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 404 -
66GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 404 -
67GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 404 -
68GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 404 -
69GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 404 -
70
71### git-daemon-export-ok
72###
73GET /smart_noexport/repo.git/HEAD HTTP/1.1 200
74GET /smart_noexport/repo.git/info/refs HTTP/1.1 200
75GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 200
76GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 200 -
77GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 200 -
78GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 200
79GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 200
80GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 200
81
7f640b77
SP
82### getanyfile true
83###
84GET /smart/repo.git/HEAD HTTP/1.1 200
85GET /smart/repo.git/info/refs HTTP/1.1 200
86GET /smart/repo.git/objects/info/packs HTTP/1.1 200
87GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
88GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
89GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
90GET /smart/repo.git/$PACK_URL HTTP/1.1 200
91GET /smart/repo.git/$IDX_URL HTTP/1.1 200
92
93### getanyfile false
94###
95GET /smart/repo.git/HEAD HTTP/1.1 403 -
96GET /smart/repo.git/info/refs HTTP/1.1 403 -
97GET /smart/repo.git/objects/info/packs HTTP/1.1 403 -
98GET /smart/repo.git/objects/info/alternates HTTP/1.1 403 -
99GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 403 -
100GET /smart/repo.git/$LOOSE_URL HTTP/1.1 403 -
101GET /smart/repo.git/$PACK_URL HTTP/1.1 403 -
102GET /smart/repo.git/$IDX_URL HTTP/1.1 403 -
103
104### uploadpack default
105###
106GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
107POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
108
109### uploadpack true
110###
111GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
112POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
113
114### uploadpack false
115###
116GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 403 -
117POST /smart/repo.git/git-upload-pack HTTP/1.1 403 -
118
119### receivepack default
120###
121GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
122POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
123
124### receivepack true
125###
126GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
127POST /smart/repo.git/git-receive-pack HTTP/1.1 200 -
128
129### receivepack false
130###
131GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
132POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
133EOF
134test_expect_success 'server request log matches test results' '
e8b3b2e2 135 check_access_log exp
7f640b77
SP
136'
137
7f640b77 138test_done