Skip to content
Myr

Changed: dont reverse `req.ips`

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

parse them as-is. im impartial about the ordering but this spares some CPU. if you prefer the other way let me know

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent e3cbac2 · Browse files · 2 files+3 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+3 added−3 removed

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

2 files+3 added−3 removed

modified:lib/request.js+2 added-2 removed
328 unmodified lines
329 * When "trust proxy" is `true`, parse330 * the "X-Forwarded-For" ip address list.331 *332 * For example if the value were "client, proxy1, proxy2"333 * you would receive the array `["proxy2", "proxy1", "client"]`333 * you would receive the array `["client", "proxy1", "proxy2"]`334 * where "proxy2" is the furthest down-stream.335 *336 * @return {Array}337 * @api public
2 unmodified lines
340req.__defineGetter__('ips', function(){341 var trustProxy = this.app.enabled('trust proxy');342 var val = this.get('X-Forwarded-For');343 return trustProxy && val344 ? val.split(/ *, */).reverse()344 ? val.split(/ *, */)345 : [];346});347348/**
64 unmodified lines
modified:test/req.ips.js+1 added-1 removed