Skip to content
Myr

lib: use req.socket over deprecated req.connection (#6705)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sebastian Beltran · committed by GitHub · parent d9a62f9 · Browse files · 2 files+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>

Diff stats

2 files+4 added−4 removed

  • tests:+1 added−1 removed
  • other:+3 added−3 removed

2 files+4 added−4 removed

modified:lib/request.js+3 added-3 removed
280 unmodified lines
281 * @public282 */283284defineGetter(req, 'protocol', function protocol(){285 var proto = this.connection.encrypted285 var proto = this.socket.encrypted286 ? 'https'287 : 'http';288 var trust = this.app.get('trust proxy fn');289290 if (!trust(this.connection.remoteAddress, 0)) {290 if (!trust(this.socket.remoteAddress, 0)) {291 return proto;292 }293294 // Note: X-Forwarded-Proto is normally only ever a
110 unmodified lines
405defineGetter(req, 'host', function host(){406 var trust = this.app.get('trust proxy fn');407 var val = this.get('X-Forwarded-Host');408409 if (!val || !trust(this.connection.remoteAddress, 0)) {409 if (!val || !trust(this.socket.remoteAddress, 0)) {410 val = this.get('Host');411 } else if (val.indexOf(',') !== -1) {412 // Note: X-Forwarded-Host is normally only ever a413 // single value, but this is to be safe.
101 unmodified lines
modified:test/req.protocol.js+1 added-1 removed