t5551: test server-side ERR packet
authorJosh Steadmon <steadmon@google.com>
Wed, 6 Feb 2019 19:19:10 +0000 (14:19 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Feb 2019 20:20:23 +0000 (12:20 -0800)
When a smart HTTP server sends an error message via pkt-line, we detect
the error due to using PACKET_READ_DIE_ON_ERR_PACKET. This case was
added by 2d103c31c2 (pack-protocol.txt: accept error packets in any
context, 2018-12-29), but not covered by tests.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-httpd.sh
t/lib-httpd/apache.conf
t/lib-httpd/error-smart-http.sh [new file with mode: 0644]
t/t5551-http-fetch-smart.sh
index e465116ef950404521ed2e119ef7cf398bf9da81..216281eabc442c2f49eed0bbf4410db9681b7698 100644 (file)
@@ -131,6 +131,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-smart-http.sh
        install_script error.sh
        install_script apply-one-time-sed.sh
 
index 5d63ed90c51cf215dd24bf634f47413c2fa27368..06a81b54c75d5948b31c03152609fccb1311c12f 100644 (file)
@@ -119,6 +119,7 @@ Alias /auth/dumb/ www/auth/dumb/
 ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/
 ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
 ScriptAlias /broken_smart/ broken-smart-http.sh/
+ScriptAlias /error_smart/ error-smart-http.sh/
 ScriptAlias /error/ error.sh/
 ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1
 <Directory ${GIT_EXEC_PATH}>
@@ -127,6 +128,9 @@ ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1
 <Files broken-smart-http.sh>
        Options ExecCGI
 </Files>
+<Files error-smart-http.sh>
+       Options ExecCGI
+</Files>
 <Files error.sh>
   Options ExecCGI
 </Files>
diff --git a/t/lib-httpd/error-smart-http.sh b/t/lib-httpd/error-smart-http.sh
new file mode 100644 (file)
index 0000000..e65d447
--- /dev/null
@@ -0,0 +1,3 @@
+echo "Content-Type: application/x-git-upload-pack-advertisement"
+echo
+printf "%s" "0019ERR server-side error"
index 8630b0cc39045f913987463a36388bcd72d6e248..ba83e567e5ca49c1664fe13f447e2744d55bfb3a 100755 (executable)
@@ -429,5 +429,10 @@ test_expect_success 'GIT_TRACE_CURL_NO_DATA prevents data from being traced' '
        ! grep "=> Send data" err
 '
 
+test_expect_success 'server-side error detected' '
+       test_must_fail git clone $HTTPD_URL/error_smart/repo.git 2>actual &&
+       grep "server-side error" actual
+'
+
 stop_httpd
 test_done