Skip to content
Myr

reverse req.ips array

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 6d0f9a3 · Browse files · 2 files+7 added−3 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+7 added−3 removed

  • tests:+2 added−2 removed
  • other:+5 added−1 removed

2 files+7 added−3 removed

modified:lib/request.js+5 added-1 removed
331 unmodified lines
332/**333 * When "trust proxy" is `true`, parse334 * the "X-Forwarded-For" ip address list.335 *336 * For example if the value were "client, proxy1, proxy2"337 * you would receive the array `["proxy2", "proxy1", "client"]`338 * where "proxy2" is the furthest down-stream.339 *340 * @return {Array}341 * @api public342 */343344req.__defineGetter__('ips', function(){345 var val = this.get('X-Forwarded-For');346 return val343 ? val.split(/ *, */)347 ? val.split(/ *, */).reverse()348 : [];349});350351/**
64 unmodified lines
modified:test/req.ips.js+2 added-2 removed