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
235 stars 13 forks source link

martian: drop custom head response implementation #872

Open Choraden opened 3 months ago

Choraden commented 3 months ago

Now that https://github.com/golang/go/issues/62015 is merged, we no longer need our custom head response implementation. Bump the go version once released and drop that function. It might be worth to add a test on that, if we don't have that already.

mmatczuk commented 2 months ago

It looks like some things changed but the issue persists. Below output of a test I did without the patch.

$ curl -x localhost:3128 -v --head http://www.google.com
* Host localhost:3128 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:3128...
* Connected to localhost (::1) port 3128
> HEAD http://www.google.com/ HTTP/1.1
> Host: www.google.com
> User-Agent: curl/8.7.1
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
* Request completely sent off
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Cache-Control: private
Cache-Control: private
< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-0fVfAdBssnogTXqR8j3dpg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-0fVfAdBssnogTXqR8j3dpg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
< Content-Type: text/html; charset=ISO-8859-1
Content-Type: text/html; charset=ISO-8859-1
< Date: Mon, 09 Sep 2024 13:21:31 GMT
Date: Mon, 09 Sep 2024 13:21:31 GMT
< Expires: Mon, 09 Sep 2024 13:21:31 GMT
Expires: Mon, 09 Sep 2024 13:21:31 GMT
< Server: gws
Server: gws
< Set-Cookie: AEC=AVYB7cq8XHwTgXJK8GCBhyspzaxy6v6a-D4odbgY8bpNiVTmxnSwlJW2Fso; expires=Sat, 08-Mar-2025 13:21:31 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax
Set-Cookie: AEC=AVYB7cq8XHwTgXJK8GCBhyspzaxy6v6a-D4odbgY8bpNiVTmxnSwlJW2Fso; expires=Sat, 08-Mar-2025 13:21:31 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 0
X-Xss-Protection: 0
< 

* chunk hex-length char not a hex digit: 0xd
* Illegal or missing hexadecimal sequence in chunked-encoding
* Closing connection