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

Close response body before moving on to next request/response #120

Closed samuong closed 1 month ago

samuong commented 1 month ago

Fixes #118

ziyiwang commented 1 month ago

sure let me test it out and come back to you, most likely removing defer will also fix the issue

samuong commented 1 month ago

I tested this today and confirmed that 1) the response body was not being closed properly, which meant that Alpaca was trying to parse the response body as if it contained the header, and 2) the fix that I suggested does work. I want to rework this a little bit to add a bit more error checking, and test it for a bit longer. Hoping to merge this PR some time this week and cut another release of Alpaca with the fix for this (and the other bug) included.

Again, thanks for reporting this issue. NTLM auth has been gradually phased out where I am, and so I'm not sure when this regression slipped in.

ziyiwang commented 1 month ago

No problem, thanks, yup agree with proper handling close body, should resolve issue, i tested with a few users on our end with the io stream fix, also confirms fix issue as body from 407 is not really needed, bit i leave it in your capable hands, thanks mate, great project, really address a gap we have with cntlm