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

Fix cookie parsing problem and location redirection with '//' at the beginning of location header #87

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yyfrankyy
Copy link

fix #85 and #86

@@ -232,6 +232,10 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){

// Redirect
if (status >= 300 && status < 400) {
if (0 == res.headers.location.indexOf('//')) {
var isHttps = req.connection.server instanceof require('tls').Server || (req.headers && req.headers['x-forwarded-proto'] == 'https')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is mega-long, this should be fine this.connection.encrypted || forwardedstuffhere, break it into two vars so it's not so crazy.
var fwd = req.headers && req.... this.connection.encrypted || fwd == 'https'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for mention that, I committed a fix 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

Successfully merging this pull request may close these issues.

Redirect to location start with '//' cause 404 error.
2 participants