Updating dependency github.com/elazarl/goproxy to version 947c36d
This commit is contained in:
14
vendor/github.com/elazarl/goproxy/https.go
generated
vendored
14
vendor/github.com/elazarl/goproxy/https.go
generated
vendored
@@ -188,7 +188,7 @@ func (proxy *ProxyHttpServer) handleHttps(w http.ResponseWriter, r *http.Request
|
||||
clientTlsReader := bufio.NewReader(rawClientTls)
|
||||
for !isEof(clientTlsReader) {
|
||||
req, err := http.ReadRequest(clientTlsReader)
|
||||
var ctx = &ProxyCtx{Req: req, Session: atomic.AddInt64(&proxy.sess, 1), proxy: proxy}
|
||||
var ctx = &ProxyCtx{Req: req, Session: atomic.AddInt64(&proxy.sess, 1), proxy: proxy, UserData: ctx.UserData}
|
||||
if err != nil && err != io.EOF {
|
||||
return
|
||||
}
|
||||
@@ -238,6 +238,8 @@ func (proxy *ProxyHttpServer) handleHttps(w http.ResponseWriter, r *http.Request
|
||||
// TODO: use a more reasonable scheme
|
||||
resp.Header.Del("Content-Length")
|
||||
resp.Header.Set("Transfer-Encoding", "chunked")
|
||||
// Force connection close otherwise chrome will keep CONNECT tunnel open forever
|
||||
resp.Header.Set("Connection", "close")
|
||||
if err := resp.Header.Write(rawClientTls); err != nil {
|
||||
ctx.Warnf("Cannot write TLS response header from mitm'd client: %v", err)
|
||||
return
|
||||
@@ -312,6 +314,10 @@ func dialerFromEnv(proxy *ProxyHttpServer) func(network, addr string) (net.Conn,
|
||||
}
|
||||
|
||||
func (proxy *ProxyHttpServer) NewConnectDialToProxy(https_proxy string) func(network, addr string) (net.Conn, error) {
|
||||
return proxy.NewConnectDialToProxyWithHandler(https_proxy, nil)
|
||||
}
|
||||
|
||||
func (proxy *ProxyHttpServer) NewConnectDialToProxyWithHandler(https_proxy string, connectReqHandler func(req *http.Request)) func(network, addr string) (net.Conn, error) {
|
||||
u, err := url.Parse(https_proxy)
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -327,6 +333,9 @@ func (proxy *ProxyHttpServer) NewConnectDialToProxy(https_proxy string) func(net
|
||||
Host: addr,
|
||||
Header: make(http.Header),
|
||||
}
|
||||
if connectReqHandler != nil {
|
||||
connectReqHandler(connectReq)
|
||||
}
|
||||
c, err := proxy.dial(network, u.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -369,6 +378,9 @@ func (proxy *ProxyHttpServer) NewConnectDialToProxy(https_proxy string) func(net
|
||||
Host: addr,
|
||||
Header: make(http.Header),
|
||||
}
|
||||
if connectReqHandler != nil {
|
||||
connectReqHandler(connectReq)
|
||||
}
|
||||
connectReq.Write(c)
|
||||
// Read response.
|
||||
// Okay to use and discard buffered reader here, because
|
||||
|
||||
Reference in New Issue
Block a user