@marcel91200 / caddy Mirror · read-only / commits / c2bbe42f
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 16:45 UTC

reverseproxy: Export SetScheme() again

Turns out the NTLM transport uses it. Oops.

Matthew Holt committed Jul 13, 2022 at 08:52 UTC c2bbe42fc3553f6a5685cdb45453c0950fa614b2
1 file changed +6 -3
modules/caddyhttp/reverseproxy/httptransport.go
+6 -3
@@ -281,7 +281,7 @@ func (h *HTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
281 repl := req.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
282 transport := h.replaceTLSServername(repl)
283
284 - transport.setScheme(req)
284 + transport.SetScheme(req)
285
286 // if H2C ("HTTP/2 over cleartext") is enabled and the upstream request is
287 // HTTP without TLS, use the alternate H2C-capable transport instead
@@ -292,10 +292,13 @@ func (h *HTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
292 return transport.Transport.RoundTrip(req)
293 }
294
295 -// setScheme ensures that the outbound request req
295 +// SetScheme ensures that the outbound request req
296 // has the scheme set in its URL; the underlying
297 // http.Transport requires a scheme to be set.
298 -func (h *HTTPTransport) setScheme(req *http.Request) {
298 +//
299 +// This method may be used by other transport modules
300 +// that wrap/use this one.
301 +func (h *HTTPTransport) SetScheme(req *http.Request) {
302 if req.URL.Scheme != "" {
303 return
304 }