Git fork

t5551: test server-side ERR packet

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>

authored by

Josh Steadmon and committed by
Junio C Hamano
30dea565 cbdb8d14

+13
+1
t/lib-httpd.sh
··· 131 131 mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH" 132 132 cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH" 133 133 install_script broken-smart-http.sh 134 + install_script error-smart-http.sh 134 135 install_script error.sh 135 136 install_script apply-one-time-sed.sh 136 137
+4
t/lib-httpd/apache.conf
··· 119 119 ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/ 120 120 ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1 121 121 ScriptAlias /broken_smart/ broken-smart-http.sh/ 122 + ScriptAlias /error_smart/ error-smart-http.sh/ 122 123 ScriptAlias /error/ error.sh/ 123 124 ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1 124 125 <Directory ${GIT_EXEC_PATH}> 125 126 Options FollowSymlinks 126 127 </Directory> 127 128 <Files broken-smart-http.sh> 129 + Options ExecCGI 130 + </Files> 131 + <Files error-smart-http.sh> 128 132 Options ExecCGI 129 133 </Files> 130 134 <Files error.sh>
+3
t/lib-httpd/error-smart-http.sh
··· 1 + echo "Content-Type: application/x-git-upload-pack-advertisement" 2 + echo 3 + printf "%s" "0019ERR server-side error"
+5
t/t5551-http-fetch-smart.sh
··· 429 429 ! grep "=> Send data" err 430 430 ' 431 431 432 + test_expect_success 'server-side error detected' ' 433 + test_must_fail git clone $HTTPD_URL/error_smart/repo.git 2>actual && 434 + grep "server-side error" actual 435 + ' 436 + 432 437 stop_httpd 433 438 test_done