saucelabs / forwarder

Forwarder is a production-ready, fast MITM proxy with PAC support. It's suitable for debugging, intercepting and manipulating HTTP traffic. It's used as a core component of Sauce Labs Sauce Connect Proxy.
https://forwarder-proxy.io
Mozilla Public License 2.0
218 stars 13 forks source link

connection leak in via loop detection #688

Closed Choraden closed 4 months ago

Choraden commented 6 months ago

Steps to Reproduce the Problem

  1. run forwarder
    go run ./cmd/forwarder run --log-http short-url --proxy-localhost allow  
  2. make a loop request
    curl -x localhost:3128 localhost:3128 
    forwarder proxy error for host "localhost:3128"
    via: detected request loop, header contains 1.1 forwarder-99abeebda2f5188c8436
  3. close forwarder
    2024/02/09 15:41:49.435234 [proxy] [INFO] closing down proxy
    2024/02/09 15:41:49.435256 [proxy] [INFO] waiting for connections to close

    It hangs waiting for connections to close...

Full log

2024/02/09 15:42:53.446295 [INFO] Forwarder Unknown (Unknown)
2024/02/09 15:42:53.446317 [INFO] configuration
log-http=short-url
proxy-localhost=allow
2024/02/09 15:42:53.446388 [proxy] [INFO] no upstream proxy specified
2024/02/09 15:42:53.446389 [proxy] [INFO] localhost proxying mode=allow
2024/02/09 15:42:53.446682 [proxy] [INFO] PROXY server listen address=[::]:3128 protocol=http
2024/02/09 15:42:53.448299 [api] [INFO] HTTP server listen address=127.0.0.1:10000 protocol=http
2024/02/09 15:42:56.973851 [proxy] [INFO] [2-feda1010] GET http://localhost:3128/ status=400 duration=104.917µs
2024/02/09 15:42:56.974253 [proxy] [INFO] [1-fe96ae10] GET http://localhost:3128/ status=400 duration=4.926292ms
^C2024/02/09 15:43:05.925492 [proxy] [INFO] closing down proxy
2024/02/09 15:43:05.925534 [proxy] [INFO] waiting for connections to close
2024/02/09 15:44:26.975553 [proxy] [INFO] all connections closed

Connection got closed 90s after the request completed.