interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t5561-http-backend.sh

138 lines · 4130 bytes Raw Blame History
1#!/bin/sh
2
3test_description='test git-http-backend'
4GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7. ./test-lib.sh
8. "$TEST_DIRECTORY"/lib-httpd.sh
9
10if ! test_have_prereq CURL; then
11 skip_all='skipping raw http-backend tests, curl not available'
12 test_done
13fi
14
15start_httpd
16
17GET() {
18 curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out &&
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" \
31 "$HTTPD_URL/smart/repo.git/$1" >out &&
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
41. "$TEST_DIRECTORY"/t556x_common
42
43grep '^[^#]' >exp <<EOF
44
45### refs/heads/main
46###
47GET /smart/repo.git/refs/heads/main HTTP/1.1 404 -
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
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
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' '
135 check_access_log exp
136'
137
138test_done