Jeff King | a5adace | 2015-09-16 13:12:52 -0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_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" |
| 7 | start_httpd |
| 8 | |
| 9 | test_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 | |
| 17 | test_proto "smart http" http "$HTTPD_URL/smart/repo.git" |
| 18 | |
Blake Burkhart | f4113ca | 2015-09-22 18:06:04 -0400 | [diff] [blame] | 19 | test_expect_success 'curl redirects respect whitelist' ' |
| 20 | test_must_fail env GIT_ALLOW_PROTOCOL=http:https \ |
| 21 | git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr && |
| 22 | { |
| 23 | test_i18ngrep "ftp.*disabled" stderr || |
| 24 | test_i18ngrep "your curl version is too old" |
| 25 | } |
| 26 | ' |
| 27 | |
Blake Burkhart | b258116 | 2015-09-22 18:06:20 -0400 | [diff] [blame] | 28 | test_expect_success 'curl limits redirects' ' |
| 29 | test_must_fail git clone "$HTTPD_URL/loop-redir/smart/repo.git" |
| 30 | ' |
| 31 | |
Jeff King | a5adace | 2015-09-16 13:12:52 -0400 | [diff] [blame] | 32 | stop_httpd |
| 33 | test_done |