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