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

Bug found in HTTP::Tiny #8

Open
rthawkcom opened this issue Nov 5, 2024 · 1 comment
Open

Bug found in HTTP::Tiny #8

rthawkcom opened this issue Nov 5, 2024 · 1 comment

Comments

@rthawkcom
Copy link

If the server responds with "\n\r" for line feeds, instead of the more common "\n", HTTP::Tiny will incorrectly assume it received two line feeds. It will then throw the ambiguous, unhelpful error as seen below:

$VAR1 = {
'url' => '<URL to server sending out "\n\r" as a line feed>',
'reason' => 'Internal Exception',
'content' => 'Unexpected end of stream while looking for line
',
'success' => '',
'headers' => {
'content-length' => 48,
'content-type' => 'text/plain'
},
'status' => 599
};

@haarg
Copy link
Member

haarg commented Nov 12, 2024

If a server is responding with \n\r it is broken. The spec defines the line separator for HTTP headers to be \r\n, but says that implementations MAY also allow a bare \n (RFC 9112, Section 2.2, Para 3).

I'm not sure there is anything worth changing here.

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

No branches or pull requests

2 participants