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

Open
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants

fix #85 and #86

@tj tj and 1 other commented on an outdated diff Sep 18, 2012

lib/browser.js
@@ -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')
@tj

tj Sep 18, 2012

Member

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'

@yyfrankyy

yyfrankyy Sep 18, 2012

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