Skip to content

Instantly share code, notes, and snippets.

@xquery
Created October 8, 2020 11:13
Show Gist options
  • Save xquery/ef94b02e763f0f04f0dc9ce5dff9aa8c to your computer and use it in GitHub Desktop.
Save xquery/ef94b02e763f0f04f0dc9ce5dff9aa8c to your computer and use it in GitHub Desktop.
latest alt-svc fumblings
<testcase>
<info>
<keywords>
HTTPS
HTTPS GET
Alt-Svc
HTTP/2
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
#
# Client-side
<client>
<features>
SSL
alt-svc
debug
</features>
<server>
https Server-localhost-sv.pem
http/2
</server>
<name>
HTTPS GET translated by alt-svc lookup to HTTP/2 GET
</name>
<setenv>
# make debug-curl accept Alt-Svc over plain HTTP
CURL_ALTSVC_HTTP="yeah"
</setenv>
<command>
--http2 --cacert %SRCDIR/certs/EdelCurlRoot-ca.crt --alt-svc "log/altsvc-360" "https://localhost:%HTTPSPORT/360"
</command>
<file name="log/altsvc-360">
h1 localhost %HTTPSPORT h2 localhost %HTTP2PORT "20290222 22:19:28" 0 0
</file>
<precheck>
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
</precheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<stripfile>
# strip out the (dynamic) expire date from the file so that the rest
# matches
s/\"2([^\"]*)\"/TIMESTAMP/
</stripfile>
<file name="log/altsvc-360" mode="text">
# Your alt-svc cache. https://curl.haxx.se/docs/alt-svc.html
# This file was generated by libcurl! Edit at your own risk.
h1 localhost %HTTPSPORT h2 localhost %HTTP2PORT TIMESTAMP 0 0
</file>
</verify>
</testcase>
11:12:06.290228 == Info: STATE: INIT => CONNECT handle 0x714e268; line 1796 (connection #-5000)
11:12:06.334035 == Info: Alt-svc connecting from [h1]localhost:25089 to [h2]localhost:23425
11:12:06.350583 == Info: Added connection 0. The cache now contains 1 members
11:12:06.381373 == Info: family0 == v6, family1 == v4
11:12:06.389300 == Info: Trying ::1:23425...
11:12:06.412350 == Info: Immediate connect fail for ::1: Cannot assign requested address
11:12:06.414756 == Info: Trying 127.0.0.1:23425...
11:12:06.417337 == Info: STATE: CONNECT => WAITCONNECT handle 0x714e268; line 1857 (connection #0)
11:12:06.508580 == Info: Connected to localhost (127.0.0.1) port 23425 (#0)
11:12:06.509447 == Info: STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x714e268; line 1990 (connection #0)
11:12:06.510883 == Info: Marked for [keep alive]: HTTP default
11:12:06.621757 == Info: ALPN, offering h2
11:12:06.622107 == Info: ALPN, offering http/1.1
11:12:06.712588 == Info: successfully set certificate verify locations:
11:12:06.712887 == Info: CAfile: ./certs/EdelCurlRoot-ca.crt
11:12:06.713137 == Info: CApath: none
11:12:06.873994 => Send SSL data, 5 bytes (0x5)
0000: .....
11:12:06.882419 == Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
11:12:06.882526 => Send SSL data, 512 bytes (0x200)
0000: [email protected]...).<...?..[E..~.x.T .......w..).p..Li..ES.i.R
0040: ..PP.L..>.......,.0.........+./...$.(.k.#.'.g.....9.....3.....=.
0080: <.5./.....u.........localhost........................3t.........
00c0: h2.http/1.1.........1.....0.....................................
0100: ............+............-.....3.&.$... T/}s.A..=..@..).1s..(...
0140: 8.Cv../@........................................................
0180: ................................................................
01c0: ................................................................
11:12:06.891485 <= Recv SSL data, 5 bytes (0x5)
0000: HTTP/
11:12:06.902414 == Info: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
11:12:06.903042 == Info: Marked for [closure]: Failed HTTPS connection
11:12:06.903693 == Info: multi_done
11:12:06.942960 == Info: The cache now contains 0 members
11:12:06.944943 == Info: Closing connection 0
11:12:06.971668 == Info: Expire cleared (transfer 0x714e268)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment