mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-06-13 15:47:38 +08:00
refactor: improve TLS config handling and add bridge connection tests
This commit is contained in:
parent
dcdb1504a3
commit
d53693952a
3 changed files with 153 additions and 7 deletions
|
|
@ -1024,7 +1024,6 @@ func (p *reverseProxyHandler) handleBridgedExtendedConnectResponse(c *Context, r
|
|||
}()
|
||||
defer close(backConnClosed)
|
||||
defer conn.Close()
|
||||
defer backConn.Close()
|
||||
|
||||
errc := make(chan error, 2)
|
||||
copyer := switchProtocolCopier{user: conn, backend: backConn}
|
||||
|
|
@ -1374,11 +1373,11 @@ func reverseProxyUsesForwardedHeader(policy ForwardedHeadersPolicy) bool {
|
|||
}
|
||||
|
||||
func reverseProxyPrepareExtendedConnectBridge(req *http.Request) (context.Context, bool, error) {
|
||||
if req == nil {
|
||||
return context.Background(), false, nil
|
||||
}
|
||||
protocol := reverseProxyExtendedConnectProtocol(req)
|
||||
if req == nil || req.Method != http.MethodConnect || protocol == "" || !strings.EqualFold(protocol, "websocket") {
|
||||
if req == nil {
|
||||
return context.Background(), false, nil
|
||||
}
|
||||
if req.Method != http.MethodConnect || protocol == "" || !strings.EqualFold(protocol, "websocket") {
|
||||
return req.Context(), false, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue