]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5812-proto-disable-http.sh
Merge branch 'sg/setup-doc-update'
[thirdparty/git.git] / t / t5812-proto-disable-http.sh
CommitLineData
a5adaced
JK
1#!/bin/sh
2
3test_description='test disabling of git-over-http in clone/fetch'
4. ./test-lib.sh
5. "$TEST_DIRECTORY/lib-proto-disable.sh"
6. "$TEST_DIRECTORY/lib-httpd.sh"
7start_httpd
8
9test_expect_success 'create git-accessible repo' '
10 bare="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
11 test_commit one &&
12 git --bare init "$bare" &&
13 git push "$bare" HEAD &&
14 git -C "$bare" config http.receivepack true
15'
16
17test_proto "smart http" http "$HTTPD_URL/smart/repo.git"
18
f4113cac
BB
19test_expect_success 'curl redirects respect whitelist' '
20 test_must_fail env GIT_ALLOW_PROTOCOL=http:https \
6628eb41 21 GIT_SMART_HTTP=0 \
f4113cac
BB
22 git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr &&
23 {
24 test_i18ngrep "ftp.*disabled" stderr ||
25 test_i18ngrep "your curl version is too old"
26 }
27'
28
b2581164
BB
29test_expect_success 'curl limits redirects' '
30 test_must_fail git clone "$HTTPD_URL/loop-redir/smart/repo.git"
31'
32
a768a022
BW
33test_expect_success 'http can be limited to from-user' '
34 git -c protocol.http.allow=user \
35 clone "$HTTPD_URL/smart/repo.git" plain.git &&
36 test_must_fail git -c protocol.http.allow=user \
37 clone "$HTTPD_URL/smart-redir-perm/repo.git" redir.git
38'
39
a5adaced
JK
40stop_httpd
41test_done