jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

getAllResponseHeaders does not include trailing CRLF #202

Open jsedlacek opened 6 years ago

jsedlacek commented 6 years ago

According to spec, the getAllResponseHeaders should include trailing CRLF: https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method

Xdomains implementation does not contain trailing CRLF. https://github.com/jpillora/xdomain/blob/gh-pages/vendor/xhook.js#L226

This breaks behavior of superagent, which pops the trailing CRLF: https://github.com/visionmedia/superagent/blob/master/lib/client.js#L203

With xdomain trailing CRLF is not present, so the last header gets stripped.

jpillora commented 6 years ago

Thanks, this should be fixed in jpillora/xhook On Fri, 8 Sep 2017 at 5:44 am Jakub Sedlacek notifications@github.com wrote:

According to spec, the getAllResponseHeaders should include trailing CRLF: https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method

Xdomains implementation does not contain trailing CRLF. https://github.com/jpillora/xdomain/blob/gh-pages/vendor/xhook.js#L226

This breaks behavior of superagent, which pops the trailing CRLF: https://github.com/visionmedia/superagent/blob/master/lib/client.js#L203

With xdomain trailing CRLF is not present, so the last header gets stripped.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jpillora/xdomain/issues/202, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmr81wkQTF83qt2hTyjgcyxq6mUQh26ks5sgEeqgaJpZM4PQTI3 .

jsedlacek commented 6 years ago

Thanks, I have created the upstream issue as well. https://github.com/jpillora/xhook/issues/72