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
Prev Previous commit
Next Next commit
Reject normal request with :protocol header
The :protocol pseudo header is only defined for
Extended Connect requests (RFC 9220).
  • Loading branch information
taoso committed Jan 24, 2024
commit 1dc608e026c20ad82f6d91801bfc5c3380c5f553
2 changes: 2 additions & 0 deletions http3/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ func requestFromHeaders(headerFields []qpack.HeaderField) (*http.Request, error)
}
} else if len(hdr.Path) == 0 || len(hdr.Authority) == 0 || len(hdr.Method) == 0 {
return nil, errors.New(":path, :authority and :method must not be empty")
} else if len(hdr.Protocol) > 0 {
return nil, errors.New(":protocol must be empty")
taoso marked this conversation as resolved.
Show resolved Hide resolved
}

var u *url.URL
Expand Down
11 changes: 11 additions & 0 deletions http3/headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ var _ = Describe("Request", func() {
Expect(err).To(MatchError(":path, :authority and :method must not be empty"))
})

It("errors with invalid protocol", func() {
headers := []qpack.HeaderField{
{Name: ":path", Value: "/foo"},
{Name: ":authority", Value: "quic.clemente.io"},
{Name: ":method", Value: "GET"},
{Name: ":protocol", Value: "connect-udp"},
}
_, err := requestFromHeaders(headers)
Expect(err).To(MatchError(":protocol must be empty"))
})

Context("regular HTTP CONNECT", func() {
It("handles CONNECT method", func() {
headers := []qpack.HeaderField{
Expand Down