samuong / alpaca

A local HTTP proxy for command-line tools. Supports PAC scripts and NTLM authentication.
Apache License 2.0
184 stars 31 forks source link

NTLM http response error , failure to read HTTPResponse is not handling malformed bluecoat http response special characters #118

Closed ziyiwang closed 1 month ago

ziyiwang commented 1 month ago

hi ,we have some NTLM responses coming back from our upstream bluecoat proxies

and the response is not accepted by alpaca , in this module 2024/03/22 15:34:14.930490 proxy-go:168: [] Got2 "malformed HTTP response \"\"" response, retri ed with auth in proxy.go page full err object is null?

in transport.go

func (t transport) RoundTrip(req http.Request) (*http.Response, error) {

can we split this function return http.ReadResponse(t.reader, req)

into separeate sendrequest , get response etc, so we can get the response back first before deciding its a malformed http response

ziyiwang commented 1 month ago

i found the issue, its related to the extra httpresponse body bluecoat is sending back with ntlm auth challenge, i will submit a PR soon