Skip to content

Commit

Permalink
remove the SkipSchemeCheck RoundTripOpt (#3353)
Browse files Browse the repository at this point in the history
This option was needed for an early draft version of MASQUE.
MASQUE now uses the https scheme.
  • Loading branch information
marten-seemann committed Mar 25, 2022
1 parent 3a10240 commit 85b4954
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
7 changes: 2 additions & 5 deletions http3/roundtrip.go
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"sync"

quic "github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go"

"golang.org/x/net/http/httpguts"
)
Expand Down Expand Up @@ -64,9 +64,6 @@ type RoundTripOpt struct {
// OnlyCachedConn controls whether the RoundTripper may create a new QUIC connection.
// If set true and no cached connection is available, RoundTrip will return ErrNoCachedConn.
OnlyCachedConn bool
// SkipSchemeCheck controls whether we check if the scheme is https.
// This allows the use of different schemes, e.g. masque://target.example.com:443/.
SkipSchemeCheck bool
}

var _ roundTripCloser = &RoundTripper{}
Expand Down Expand Up @@ -100,7 +97,7 @@ func (r *RoundTripper) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.
}
}
}
} else if !opt.SkipSchemeCheck {
} else {
closeRequestBody(req)
return nil, fmt.Errorf("http3: unsupported protocol scheme: %s", req.URL.Scheme)
}
Expand Down
9 changes: 0 additions & 9 deletions http3/roundtrip_test.go
Expand Up @@ -179,15 +179,6 @@ var _ = Describe("RoundTripper", func() {
Expect(req.Body.(*mockBody).closed).To(BeTrue())
})

It("allow non-https schemes if SkipSchemeCheck is set", func() {
req, err := http.NewRequest("GET", "masque://www.example.org/", nil)
Expect(err).ToNot(HaveOccurred())
_, err = rt.RoundTrip(req)
Expect(err).To(MatchError("http3: unsupported protocol scheme: masque"))
_, err = rt.RoundTripOpt(req, RoundTripOpt{SkipSchemeCheck: true, OnlyCachedConn: true})
Expect(err).To(MatchError("http3: no cached connection was available"))
})

It("rejects requests without a URL", func() {
req1.URL = nil
req1.Body = &mockBody{}
Expand Down

0 comments on commit 85b4954

Please sign in to comment.