diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
End a request quietly when the client has gone
A write that failed with EPIPE on an uncached page died into an error page, which died again at exit when the page could not be sent either, and git logged a recursion warning on every dropped connection. A filter that exits early fails a write the same way, so the quiet exit is kept for writes that reach the client itself.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0303-robustness.sh16
1 file changed, 16 insertions, 0 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index 55a83c3..fd1c02e 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -529,6 +529,22 @@ test_expect_success 'the dumb transport withholds the alternates file' '
grep "^Status: 200" tmp
'
+# A client that goes away mid-page leaves nobody to send an error page to,
+# so the request ends quietly instead of dying twice into the log. The page
+# has to outgrow the pipe for the write after the reader has gone to fail.
+test_expect_success 'a client that disconnects ends the request quietly' '
+ (
+ cd repos/rob &&
+ awk "BEGIN{for(i=0;i<20000;i++) print \"line \" i}" >long.txt &&
+ git add long.txt &&
+ git commit -m long
+ ) &&
+ { robq "url=rob/tree/long.txt" 2>err; echo $? >status; } | head -c 1 >/dev/null &&
+ test "$(cat status)" = 0 &&
+ ! grep -i "broken pipe" err &&
+ ! grep "die()" err
+'
+
# The about page redirects to its trailing-slash form so relative links
# resolve, and the branch asked for has to survive that hop, as does the
# hop back to the summary of a repository without a readme.