Skip to content

Commit

Permalink
https: don't overwrite servername option
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node-v0.x-archive#9368
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
  • Loading branch information
skenqbx authored and jasnell committed Aug 29, 2015
1 parent 75c84b2 commit 572663f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -1283,11 +1283,13 @@ Agent.prototype.createSocket = function(name, host, port, localAddress, req) {
options.host = host;
options.localAddress = localAddress;

options.servername = host;
if (req) {
var hostHeader = req.getHeader('host');
if (hostHeader) {
options.servername = hostHeader.replace(/:.*$/, '');
if (!options.servername) {
options.servername = host;
if (req) {
var hostHeader = req.getHeader('host');
if (hostHeader) {
options.servername = hostHeader.replace(/:.*$/, '');
}
}
}

Expand Down

0 comments on commit 572663f

Please sign in to comment.