Skip to content

Commit

Permalink
Fix protocol
Browse files Browse the repository at this point in the history
The default value should be "HTTP/3.0".
  • Loading branch information
taoso committed Jan 23, 2024
1 parent a2cf43d commit 8d3b667
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 8d3b667

Please sign in to comment.