summaryrefslogtreecommitdiff
path: root/t/t5560-http-backend-noserver.sh
diff options
context:
space:
mode:
authorTarmigan Casebolt <tarmigan+git@gmail.com>2010-01-02 13:38:06 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-06 01:18:32 -0800
commit04481adffe7d4d969d7067d7a6d6e5e46e44f1c8 (patch)
tree2ec21eecd6312ab7cbafbe6a9827b6f25ba5aee8 /t/t5560-http-backend-noserver.sh
parent43015774c3a697abf8efee28e36238fc78cf45d1 (diff)
downloadgit-04481adffe7d4d969d7067d7a6d6e5e46e44f1c8.tar.gz
Smart-http tests: Break test t5560-http-backend into pieces
This should introduce no functional change in the tests or the amount of test coverage. Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5560-http-backend-noserver.sh')
-rwxr-xr-xt/t5560-http-backend-noserver.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh
new file mode 100755
index 0000000000..a9ba2d9aae
--- /dev/null
+++ b/t/t5560-http-backend-noserver.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+test_description='test git-http-backend-noserver'
+. ./test-lib.sh
+
+HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
+
+run_backend() {
+ REQUEST_METHOD=GET \
+ GIT_PROJECT_ROOT="$HTTPD_DOCUMENT_ROOT_PATH" \
+ PATH_INFO="$1" \
+ git http-backend >act.out 2>act.err
+}
+
+GET() {
+ return 0
+}
+
+POST() {
+ return 0
+}
+
+log_div() {
+ return 0
+}
+
+. "$TEST_DIRECTORY"/t556x_common
+
+expect_aliased() {
+ if test $1 = 0; then
+ run_backend "$2"
+ else
+ run_backend "$2" &&
+ echo "fatal: '$2': aliased" >exp.err &&
+ test_cmp exp.err act.err
+ fi
+}
+
+test_expect_success 'http-backend blocks bad PATH_INFO' '
+ config http.getanyfile true &&
+
+ expect_aliased 0 /repo.git/HEAD &&
+
+ expect_aliased 1 /repo.git/../HEAD &&
+ expect_aliased 1 /../etc/passwd &&
+ expect_aliased 1 ../etc/passwd &&
+ expect_aliased 1 /etc//passwd &&
+ expect_aliased 1 /etc/./passwd &&
+ expect_aliased 1 //domain/data.txt
+'
+
+test_done