1
0
Fork 0

Fix NTLM and Kerberos

This commit is contained in:
Julien Salleyron 2024-02-06 17:34:07 +01:00 committed by GitHub
parent 8f9ad16f54
commit e11ff98608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 161 additions and 3 deletions

View file

@ -11,7 +11,7 @@ import (
"golang.org/x/net/http2"
)
func newSmartRoundTripper(transport *http.Transport, forwardingTimeouts *dynamic.ForwardingTimeouts) (http.RoundTripper, error) {
func newSmartRoundTripper(transport *http.Transport, forwardingTimeouts *dynamic.ForwardingTimeouts) (*smartRoundTripper, error) {
transportHTTP1 := transport.Clone()
transportHTTP2, err := http2.ConfigureTransports(transport)
@ -53,6 +53,12 @@ type smartRoundTripper struct {
http *http.Transport
}
func (m *smartRoundTripper) Clone() http.RoundTripper {
h := m.http.Clone()
h2 := m.http2.Clone()
return &smartRoundTripper{http: h, http2: h2}
}
func (m *smartRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
// If we have a connection upgrade, we don't use HTTP/2
if httpguts.HeaderValuesContainsToken(req.Header["Connection"], "Upgrade") {