Skip to content

Commit a4deb4f

Browse files
marten-seemannnmldiegues
authored andcommitted
remove the SkipSchemeCheck RoundTripOpt (quic-go#3353)
This option was needed for an early draft version of MASQUE. MASQUE now uses the https scheme.
1 parent 5aa0478 commit a4deb4f

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

http3/roundtrip.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
"sync"
1111

12-
quic "github.com/lucas-clemente/quic-go"
12+
"github.com/lucas-clemente/quic-go"
1313

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

7269
var _ roundTripCloser = &RoundTripper{}
@@ -100,7 +97,7 @@ func (r *RoundTripper) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.
10097
}
10198
}
10299
}
103-
} else if !opt.SkipSchemeCheck {
100+
} else {
104101
closeRequestBody(req)
105102
return nil, fmt.Errorf("http3: unsupported protocol scheme: %s", req.URL.Scheme)
106103
}

http3/roundtrip_test.go

-9
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,6 @@ var _ = Describe("RoundTripper", func() {
179179
Expect(req.Body.(*mockBody).closed).To(BeTrue())
180180
})
181181

182-
It("allow non-https schemes if SkipSchemeCheck is set", func() {
183-
req, err := http.NewRequest("GET", "masque://www.example.org/", nil)
184-
Expect(err).ToNot(HaveOccurred())
185-
_, err = rt.RoundTrip(req)
186-
Expect(err).To(MatchError("http3: unsupported protocol scheme: masque"))
187-
_, err = rt.RoundTripOpt(req, RoundTripOpt{SkipSchemeCheck: true, OnlyCachedConn: true})
188-
Expect(err).To(MatchError("http3: no cached connection was available"))
189-
})
190-
191182
It("rejects requests without a URL", func() {
192183
req1.URL = nil
193184
req1.Body = &mockBody{}

0 commit comments

Comments
 (0)