t5551: lower-case headers in expected curl trace
commit4a21230ab0d8b6aac4b00e9f948a34d377d2a6af
authorJeff King <peff@peff.net>
Thu, 23 Feb 2023 10:54:02 +0000 (23 05:54 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2023 21:01:14 +0000 (23 13:01 -0800)
tree50d3a90a7ea52738805f4283c44698a939115965
parenta58f4d6328b71dbcaab517bf5b0b487be4029cf0
t5551: lower-case headers in expected curl trace

There's a test in t5551 which checks the curl trace (after simplifying
it a bit). It doesn't work with HTTP/2, because in that case curl
outputs all of the headers in lower-case. Even though this test is run
with HTTP/2 by t5559, nobody has noticed because checking the trace only
happens if GIT_TEST_PROTOCOL_VERSION is manually set to "0".

Let's fix this by lower-casing all of the header names in the trace, and
then checking for those in our expected code (this is easier than making
HTTP/2 traces look like HTTP/1.1, since HTTP/1.1 uses title-casing).

Sadly, we can't quite do this in our existing sed script. This works if
you have GNU sed:

  s/^\\([><]\\) \\([A-Za-z0-9-]*:\\)/\1 \L\2\E/

but \L is a GNU-ism, and I don't think there's a portable solution. We
could just "tr A-Z a-z" on the way in, of course, but that makes the
non-header parts harder to read (e.g., lowercase "post" requests). But
to paraphrase Baron Munchausen, I have learned from experience that a
modicum of Perl can be most efficacious.

Note that this doesn't quite get the test passing with t5559; there are
more fixes needed on top.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5551-http-fetch-smart.sh