Skip to content

Commit

Permalink
http_proxy: change ConnectPassthrough to ConnectFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatczuk committed Nov 17, 2023
1 parent 0cf71d4 commit af05b23
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af05b23

Please sign in to comment.