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

http3: only use :protocol pseudo-header for Extended CONNECT #4261

Merged
merged 4 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix protocol
The default value should be "HTTP/3.0".
  • Loading branch information
taoso committed Jan 23, 2024
commit 8d3b6670a2a23e45a3441ed0c50a10e036767342
8 changes: 5 additions & 3 deletions http3/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ func requestFromHeaders(headerFields []qpack.HeaderField) (*http.Request, error)

var u *url.URL
var requestURI string
var protocol string

protocol := "HTTP/3.0"

if isConnect {
u = &url.URL{}
Expand All @@ -143,9 +144,10 @@ func requestFromHeaders(headerFields []qpack.HeaderField) (*http.Request, error)
u.Scheme = hdr.Scheme
u.Host = hdr.Authority
requestURI = hdr.Authority
protocol = hdr.Protocol
if hdr.Protocol != "" {
protocol = hdr.Protocol
}
} else {
protocol = "HTTP/3.0"
u, err = url.ParseRequestURI(hdr.Path)
if err != nil {
return nil, fmt.Errorf("invalid content length: %w", err)
Expand Down
1 change: 1 addition & 0 deletions http3/headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ var _ = Describe("Request", func() {
req, err := requestFromHeaders(headers)
Expect(err).NotTo(HaveOccurred())
Expect(req.Method).To(Equal(http.MethodConnect))
Expect(req.Proto).To(Equal("HTTP/3.0"))
Expect(req.RequestURI).To(Equal("quic.clemente.io"))
})

Expand Down