Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with header parse buffer logic #207

Closed
byjrack opened this issue Jun 26, 2023 · 2 comments
Closed

Issue with header parse buffer logic #207

byjrack opened this issue Jun 26, 2023 · 2 comments

Comments

@byjrack
Copy link
Contributor

byjrack commented Jun 26, 2023

So was getting some exceptions after the move from 5.0.1 to 6.1.0 and traced it to the new header parsing

I was noticing that headerParts seemed to collect all the content in the proxy response and not just the headers. In our case the 407 is accompanied by some HTML indicating the issue.

Looking at the code you grab endOfHeaders for building the buffer, but are not using it in the headerParts array creation. In my case that means the content page gets included and then you start getting Invalid Header exceptions.

I have not tested this heavily, especially on really long responses that might require the "end of" recursive call, but should headerParts only use a slice of buffered?

const headerParts = buffered.slice(0,endOfHeaders).toString('ascii').split('\r\n');
@TooTallNate
Copy link
Owner

Ya that seems like a bug. PR welcome!

@byjrack
Copy link
Contributor Author

byjrack commented Jun 26, 2023

Cool I have a few internal gates to pass so may take a little bit even for a papercut, but hopefully shouldn't be stuck for long. I also want to run through your contributing to make sure I can tick all the boxes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants