GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http: refactor to make servername option normalization testable · nodejs/node@f46bcf1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _http_agent.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_http_agent.js‎

Copy file name to clipboardExpand all lines: lib/_http_agent.js
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
253253
if (options.socketPath)
254254
options.path = options.socketPath;
255255

256-
if (!options.servername && options.servername !== '')
257-
options.servername = calculateServerName(options, req);
256+
normalizeServerName(options, req);
258257

259258
const name = this.getName(options);
260259
if (!this.sockets[name]) {
@@ -313,8 +312,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
313312
if (options.socketPath)
314313
options.path = options.socketPath;
315314

316-
if (!options.servername && options.servername !== '')
317-
options.servername = calculateServerName(options, req);
315+
normalizeServerName(options, req);
318316

319317
const name = this.getName(options);
320318
options._agentKey = name;
@@ -344,6 +342,11 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
344342
oncreate(null, newSocket);
345343
};
346344

345+
function normalizeServerName(options, req) {
346+
if (!options.servername && options.servername !== '')
347+
options.servername = calculateServerName(options, req);
348+
}
349+
347350
function calculateServerName(options, req) {
348351
let servername = options.host;
349352
const hostHeader = req.getHeader('host');

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.