Skip to content

Commit

Permalink
t5550: test display of remote http error messages
Browse files Browse the repository at this point in the history
Since commit 426e70d (remote-curl: show server content on
http errors, 2013-04-05), we relay any text/plain error
messages from the remote server to the user. However, we
never tested it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
peff authored and gitster committed May 23, 2014
1 parent c7db2d1 commit dbcf2bd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/lib-httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ prepare_httpd() {
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH"
install_script broken-smart-http.sh
install_script error.sh

ln -s "$LIB_HTTPD_MODULE_PATH" "$HTTPD_ROOT_PATH/modules"

Expand Down
4 changes: 4 additions & 0 deletions t/lib-httpd/apache.conf
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ Alias /auth/dumb/ www/auth/dumb/
</LocationMatch>
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
ScriptAlias /broken_smart/ broken-smart-http.sh/
ScriptAlias /error/ error.sh/
<Directory ${GIT_EXEC_PATH}>
Options FollowSymlinks
</Directory>
<Files broken-smart-http.sh>
Options ExecCGI
</Files>
<Files error.sh>
Options ExecCGI
</Files>
<Files ${GIT_EXEC_PATH}/git-http-backend>
Options ExecCGI
</Files>
Expand Down
17 changes: 17 additions & 0 deletions t/lib-httpd/error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

printf "Status: 500 Intentional Breakage\n"

printf "Content-Type: "
case "$PATH_INFO" in
*html*)
printf "text/html"
;;
*text*)
printf "text/plain"
;;
esac
printf "\n"

printf "\n"
printf "this is the error message\n"
10 changes: 10 additions & 0 deletions t/t5550-http-fetch-dumb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,15 @@ test_expect_success 'did not use upload-pack service' '
test_cmp exp act
'

test_expect_success 'git client shows text/plain errors' '
test_must_fail git clone "$HTTPD_URL/error/text" 2>stderr &&
grep "this is the error message" stderr
'

test_expect_success 'git client does not show html errors' '
test_must_fail git clone "$HTTPD_URL/error/html" 2>stderr &&
! grep "this is the error message" stderr
'

stop_httpd
test_done

0 comments on commit dbcf2bd

Please sign in to comment.