From af05b2323946966549861457cefdaf780f89d1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Matczuk?= Date: Fri, 17 Nov 2023 14:55:45 +0100 Subject: [PATCH] http_proxy: change ConnectPassthrough to ConnectFunc --- http_proxy.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/http_proxy.go b/http_proxy.go index 2b077a9f..b92336f3 100644 --- a/http_proxy.go +++ b/http_proxy.go @@ -72,8 +72,14 @@ type ( RequestResponseModifier = martian.RequestResponseModifier RequestModifierFunc = martian.RequestModifierFunc ResponseModifierFunc = martian.ResponseModifierFunc + + ConnectFunc = martian.ConnectFunc ) +// ErrConnectFallback is returned by a ConnectFunc to indicate +// that the CONNECT request should be handled by martian. +var ErrConnectFallback = martian.ErrConnectFallback + type HTTPProxyConfig struct { HTTPServerConfig Name string @@ -88,7 +94,7 @@ type HTTPProxyConfig struct { RequestModifiers []RequestModifier ResponseModifiers []ResponseModifier ConnectRequestModifier func(*http.Request) error - ConnectPassthrough bool + ConnectFunc ConnectFunc CloseAfterReply bool ReadLimit SizeSuffix WriteLimit SizeSuffix @@ -249,7 +255,7 @@ func (hp *HTTPProxy) configureProxy() error { hp.proxy.AllowHTTP = true hp.proxy.RequestIDHeader = hp.config.RequestIDHeader hp.proxy.ConnectRequestModifier = hp.config.ConnectRequestModifier - hp.proxy.ConnectPassthrough = hp.config.ConnectPassthrough + hp.proxy.ConnectFunc = hp.config.ConnectFunc hp.proxy.WithoutWarning = true hp.proxy.ErrorResponse = hp.errorResponse hp.proxy.CloseAfterReply = hp.config.CloseAfterReply