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

additional debug statements #986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ function session(options) {
}

if (!shouldSetCookie(req)) {
debug('should not set cookie');
return;
}

Expand All @@ -240,6 +241,7 @@ function session(options) {
if (!touched) {
// touch session
req.session.touch()
debug('touch session');
touched = true
}

Expand Down Expand Up @@ -631,17 +633,21 @@ function hash(sess) {
function issecure(req, trustProxy) {
// socket is https server
if (req.connection && req.connection.encrypted) {
debug('connection encrypted');
return true;
}

// do not trust proxy
if (trustProxy === false) {
debug('proxy untrusted');
return false;
}

// no explicit trust; try req.secure from express
if (trustProxy !== true) {
return req.secure === true
var reqSecure = req.secure === true
debug('request %s', reqSecure ? 'secure' : 'insecure');
return reqSecure
}

// read the proto from x-forwarded-proto header
Expand All @@ -651,7 +657,9 @@ function issecure(req, trustProxy) {
? header.substr(0, index).toLowerCase().trim()
: header.toLowerCase().trim()

return proto === 'https';
var protoSecure = proto === 'https';
debug('protocol %s', protoSecure ? 'secure' : 'insecure');
return protoSecure;
}

/**
Expand Down