diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-04-22 13:42:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-22 13:42:44 -0700 |
commit | 5ee5788af680ebc20b138f40fb0bfd79494ba95c (patch) | |
tree | 562784f7cd50ff5a3d11a0d44372c71724a59976 /t/t5562-http-backend-content-length.sh | |
parent | Merge branch 'jk/test-cleanup' (diff) | |
parent | test-lib-functions: simplify packetize() stdin code (diff) | |
download | tgif-5ee5788af680ebc20b138f40fb0bfd79494ba95c.tar.xz |
Merge branch 'jk/harden-protocol-v2-delim-handling'
The server-end of the v2 protocol to serve "git clone" and "git
fetch" was not prepared to see a delim packets at unexpected
places, which led to a crash.
* jk/harden-protocol-v2-delim-handling:
test-lib-functions: simplify packetize() stdin code
upload-pack: handle unexpected delim packets
test-lib-functions: make packetize() more efficient
Diffstat (limited to 't/t5562-http-backend-content-length.sh')
-rwxr-xr-x | t/t5562-http-backend-content-length.sh | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh index 4a110b307e..3f4ac71f83 100755 --- a/t/t5562-http-backend-content-length.sh +++ b/t/t5562-http-backend-content-length.sh @@ -53,15 +53,20 @@ test_expect_success 'setup' ' test_commit c1 && hash_head=$(git rev-parse HEAD) && hash_prev=$(git rev-parse HEAD~1) && - printf "want %s" "$hash_head" | packetize >fetch_body && - printf 0000 >>fetch_body && - printf "have %s" "$hash_prev" | packetize >>fetch_body && - printf done | packetize >>fetch_body && + { + packetize "want $hash_head" && + printf 0000 && + packetize "have $hash_prev" && + packetize "done" + } >fetch_body && test_copy_bytes 10 <fetch_body >fetch_body.trunc && hash_next=$(git commit-tree -p HEAD -m next HEAD^{tree}) && - printf "%s %s refs/heads/newbranch\\0report-status\\n" "$ZERO_OID" "$hash_next" | packetize >push_body && - printf 0000 >>push_body && - echo "$hash_next" | git pack-objects --stdout >>push_body && + { + printf "%s %s refs/heads/newbranch\\0report-status\\n" \ + "$ZERO_OID" "$hash_next" | packetize && + printf 0000 && + echo "$hash_next" | git pack-objects --stdout + } >push_body && test_copy_bytes 10 <push_body >push_body.trunc && : >empty_body ' |