Skip to content

Commit 30dea56

Browse files
steadmongitster
authored andcommitted
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 2d103c3 (pack-protocol.txt: accept error packets in any context, 2018-12-29), but not covered by tests. Signed-off-by: Josh Steadmon <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cbdb8d1 commit 30dea56

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

t/lib-httpd.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ prepare_httpd() {
131131
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
132132
cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH"
133133
install_script broken-smart-http.sh
134+
install_script error-smart-http.sh
134135
install_script error.sh
135136
install_script apply-one-time-sed.sh
136137

t/lib-httpd/apache.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Alias /auth/dumb/ www/auth/dumb/
119119
ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/
120120
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
121121
ScriptAlias /broken_smart/ broken-smart-http.sh/
122+
ScriptAlias /error_smart/ error-smart-http.sh/
122123
ScriptAlias /error/ error.sh/
123124
ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1
124125
<Directory ${GIT_EXEC_PATH}>
@@ -127,6 +128,9 @@ ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1
127128
<Files broken-smart-http.sh>
128129
Options ExecCGI
129130
</Files>
131+
<Files error-smart-http.sh>
132+
Options ExecCGI
133+
</Files>
130134
<Files error.sh>
131135
Options ExecCGI
132136
</Files>

t/lib-httpd/error-smart-http.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
echo "Content-Type: application/x-git-upload-pack-advertisement"
2+
echo
3+
printf "%s" "0019ERR server-side error"

t/t5551-http-fetch-smart.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,5 +429,10 @@ test_expect_success 'GIT_TRACE_CURL_NO_DATA prevents data from being traced' '
429429
! grep "=> Send data" err
430430
'
431431

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+
432437
stop_httpd
433438
test_done

0 commit comments

Comments
 (0)