summaryrefslogtreecommitdiff
path: root/t/t5551-http-fetch-smart.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-02-23 10:56:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-02-23 21:01:14 (GMT)
commit8dfe36b0075b99cdd5386e85419bc3edfd2fbcd5 (patch)
tree8392a991904ca972f86a5a69164186515632f267 /t/t5551-http-fetch-smart.sh
parent4a21230ab0d8b6aac4b00e9f948a34d377d2a6af (diff)
downloadgit-8dfe36b0075b99cdd5386e85419bc3edfd2fbcd5.zip
git-8dfe36b0075b99cdd5386e85419bc3edfd2fbcd5.tar.gz
git-8dfe36b0075b99cdd5386e85419bc3edfd2fbcd5.tar.bz2
t5551: handle HTTP/2 when checking curl trace
We check that the curl trace of a clone has the lines we expect, but this won't work when we run the test under t5559, because a few details are different under HTTP/2 (but nobody noticed because it only happens when you manually set GIT_TEST_PROTOCOL_VERSION to "0"). We can handle both HTTP protocols with a few tweaks: - we'll drop the HTTP "101 Switching Protocols" response, as well as various protocol upgrade headers. These details aren't interesting to us. We just want to make sure the correct protocol was used (and we do in the main request/response lines). - successful HTTP/2 responses just say "200" and not "200 OK"; we can normalize these - replace HTTP/1.1 with a variable in the request/response lines. We can use the existing $HTTP_PROTO for this, as it's already set to "HTTP/2" when appropriate. We do need to tweak the fallback value to "HTTP/1.1" to match what curl will write (prior to this patch, the fallback value didn't matter at all; we only checked if it was the literal string "HTTP/2"). Note that several lines still expect HTTP/1.1 unconditionally. The first request does so because the client requests an upgrade during the request. The POST request and response do so because you can't do an upgrade if there is a request body. (This will all be different if we trigger HTTP/2 via ALPN, but the tests aren't yet capable of that). This is enough to let: GIT_TEST_PROTOCOL_VERSION=0 ./t5559-http-fetch-smart-http2.sh pass the "clone http repository" test (but there are some other failures later on). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5551-http-fetch-smart.sh')
-rwxr-xr-xt/t5551-http-fetch-smart.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index a81f852..716c9db 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-: ${HTTP_PROTO:=HTTP}
+: ${HTTP_PROTO:=HTTP/1.1}
test_description="test smart fetching over http via http-backend ($HTTP_PROTO)"
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
@@ -33,13 +33,13 @@ test_expect_success 'create http-accessible bare repository' '
setup_askpass_helper
test_expect_success 'clone http repository' '
- cat >exp <<-\EOF &&
+ cat >exp <<-EOF &&
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
> accept: */*
> accept-encoding: ENCODINGS
> accept-language: ko-KR, *;q=0.9
> pragma: no-cache
- < HTTP/1.1 200 OK
+ < $HTTP_PROTO 200 OK
< pragma: no-cache
< cache-control: no-cache, max-age=0, must-revalidate
< content-type: application/x-git-upload-pack-advertisement
@@ -83,6 +83,14 @@ test_expect_success 'clone http repository' '
s/^/> /
}
+ /^< HTTP/ {
+ s/200$/200 OK/
+ }
+ /^< HTTP\\/1.1 101/d
+ /^[><] connection: /d
+ /^[><] upgrade: /d
+ /^> http2-settings: /d
+
/^> user-agent: /d
/^> host: /d
/^> POST /,$ {