-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Support Tolerance Provision when parsing headers #449
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
Support Tolerance Provision when parsing headers #449
Conversation
a329ed3
to
5d1eaa4
Compare
Thanks for reporting. Why support the single |
5d1eaa4
to
959eb05
Compare
Changed to remove support for single |
@@ -355,7 +355,7 @@ | |||
|
|||
function parseHeaders(rawHeaders) { | |||
var headers = new Headers() | |||
rawHeaders.split('\r\n').forEach(function(line) { | |||
rawHeaders.replace('\r\n', '\n').split('\n').forEach(function(line) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work as simply split(/\r?\n/)
to avoid the replace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that works - thanks for your quick response!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushing a change now
959eb05
to
eac7a2b
Compare
Thanks! |
Edited scope of impact in original post. |
The change to fix this issue #422 has created another issue for our app on the iPhone 4s running iOS 8.2 and iOS 9.3. The impact prevents these users from using one of two methods to login into their accounts.
More specifically, the result of splitting by
\r\n
and not both\r\n
and\n
is a malformed response header with all the actual headers put into the 'pragma' key and a content type oftext/plain;charset=UTF-8
instead ofapplication/json
.Source:
http://stackoverflow.com/a/5757349
more specifically, https://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.3