Skip to content
Myr

Added `req.ip`

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

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent b694ba2 · Browse files · 2 files+15 added−2 removed
This commit

State

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

Diff stats

2 files+15 added−2 removed

  • tests:+2 added−2 removed
  • other:+13 added−0 removed

2 files+15 added−2 removed

modified:lib/request.js+13 added
324 unmodified lines
325 return 'https' == this.protocol;326});327328/**329 * Return the remote address, or when330 * "trust proxy" is `true` return331 * the upstream addr.332 *333 * @return {String}334 * @api public335 */336337req.__defineGetter__('ip', function(){338 return this.ips[0] || this.connection.remoteAddress;339});340341/**342 * When "trust proxy" is `true`, parse343 * the "X-Forwarded-For" ip address list.344 *345 * For example if the value were "client, proxy1, proxy2"
80 unmodified lines
modified:test/req.ips.js+2 added-2 removed