Skip to content

Commit 8619002

Browse files
peffgitster
authored andcommitted
t5559: fix test failures with LIB_HTTPD_SSL
One test needs to be tweaked in order for t5559 to pass with SSL/TLS set up. When we make our initial clone, we check that the curl trace of requests is what we expected. But we need to fix two things: - along with ignoring "data" lines from the trace, we need to ignore "SSL data" lines - when TLS is used, the server is able to tell the client (via ALPN) that it supports HTTP/2 before the first HTTP request is made. So rather than request an upgrade using an HTTP header, it can just speak HTTP/2 immediately With this patch, running: LIB_HTTPD_SSL=1 ./t5559-http-fetch-smart-http2.sh works, whereas it did not before. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c14419 commit 8619002

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,19 @@ test_expect_success 'create http-accessible bare repository' '
3333
setup_askpass_helper
3434

3535
test_expect_success 'clone http repository' '
36+
if test_have_prereq HTTP2 && test "$HTTPD_PROTO" = "https"
37+
then
38+
# ALPN lets us immediately use HTTP/2; likewise, POSTs with
39+
# bodies can use it because they do not need to upgrade
40+
INITIAL_PROTO=HTTP/2
41+
else
42+
# either we are not using HTTP/2, or the initial
43+
# request is sent via HTTP/1.1 and asks for upgrade
44+
INITIAL_PROTO=HTTP/1.1
45+
fi &&
46+
3647
cat >exp.raw <<-EOF &&
37-
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
48+
> GET /smart/repo.git/info/refs?service=git-upload-pack $INITIAL_PROTO
3849
> accept: */*
3950
> accept-encoding: ENCODINGS
4051
> accept-language: ko-KR, *;q=0.9
@@ -44,25 +55,25 @@ test_expect_success 'clone http repository' '
4455
< pragma: no-cache
4556
< cache-control: no-cache, max-age=0, must-revalidate
4657
< content-type: application/x-git-upload-pack-advertisement
47-
> POST /smart/repo.git/git-upload-pack HTTP/1.1
58+
> POST /smart/repo.git/git-upload-pack $INITIAL_PROTO
4859
> accept-encoding: ENCODINGS
4960
> content-type: application/x-git-upload-pack-request
5061
> accept: application/x-git-upload-pack-result
5162
> accept-language: ko-KR, *;q=0.9
5263
{V2} > git-protocol: version=2
5364
> content-length: xxx
54-
< HTTP/1.1 200 OK
65+
< $INITIAL_PROTO 200 OK
5566
< pragma: no-cache
5667
< cache-control: no-cache, max-age=0, must-revalidate
5768
< content-type: application/x-git-upload-pack-result
58-
{V2} > POST /smart/repo.git/git-upload-pack HTTP/1.1
69+
{V2} > POST /smart/repo.git/git-upload-pack $INITIAL_PROTO
5970
{V2} > accept-encoding: ENCODINGS
6071
{V2} > content-type: application/x-git-upload-pack-request
6172
{V2} > accept: application/x-git-upload-pack-result
6273
{V2} > accept-language: ko-KR, *;q=0.9
6374
{V2} > git-protocol: version=2
6475
{V2} > content-length: xxx
65-
{V2} < HTTP/1.1 200 OK
76+
{V2} < $INITIAL_PROTO 200 OK
6677
{V2} < pragma: no-cache
6778
{V2} < cache-control: no-cache, max-age=0, must-revalidate
6879
{V2} < content-type: application/x-git-upload-pack-result
@@ -96,6 +107,8 @@ test_expect_success 'clone http repository' '
96107
s/= Recv header://
97108
/^<= Recv data/d
98109
/^=> Send data/d
110+
/^<= Recv SSL data/d
111+
/^=> Send SSL data/d
99112
/^$/d
100113
/^< $/d
101114

0 commit comments

Comments
 (0)