Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support http2-prior-knowledge #356

Merged
merged 1 commit into from
Mar 23, 2024
Merged

Conversation

zuisong
Copy link
Contributor

@zuisong zuisong commented Mar 22, 2024

--http2-prior-knowledge
(HTTP) Issue a non-TLS HTTP requests using HTTP/2 directly without HTTP/1.1 Upgrade. It requires prior knowledge that the server supports HTTP/2 straight away. HTTPS requests still do HTTP/2 the standard way with negotiated protocol version in the TLS handshake.

https://curl.se/docs/manpage.html#--http2-prior-knowledge

current:

❯ xh --http-version=2 http://x.com -v
GET / HTTP/2.0
accept: */*
accept-encoding: gzip, deflate, br
host: x.com
user-agent: xh/0.21.0

xh: error: error sending request for url (http://x.com/): request has unsupported HTTP version

Caused by:
    request has unsupported HTTP version

xh on http2_prior_knowledge:master [⇡] is 📦 v0.21.0 via 🦀 v1.76.0 

after:

❯ cargo run -- --http-version=2-prior-knowledge  http://x.com -v
    Finished dev [unoptimized + debuginfo] target(s) in 0.31s
     Running `/Users/xxx/.rust-target/debug/xh --http-version=2-prior-knowledge 'http://x.com' -v`
GET / HTTP/2.0
accept: */*
accept-encoding: gzip, deflate, br
host: x.com
user-agent: xh/0.21.0

HTTP/2.0 301 Moved Permanently
cache-control: no-cache, no-store, max-age=0
content-length: 0
date: Fri, 22 Mar 2024 04:22:32 GMT
location: https://x.com/
perf: 7469935968
server: tsa_q
x-connection-hash: 7a464c1a076a5af16cde9cf3594760f6edde4ea5c7f91ef75c564d470b595130
x-response-time: 119
x-transaction-id: 9d05eb595bc41b2e

Copy link
Owner

@ducaale ducaale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ducaale ducaale merged commit dc60a57 into ducaale:master Mar 23, 2024
8 of 9 checks passed
@zuisong zuisong deleted the http2_prior_knowledge branch March 23, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants