Skip to content
Myr

Support IP address host in req.subdomains

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

fixes #2308

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent d07c063 · Browse files · 3 files+59 added−1 removed
This commit

State

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

Diff stats

3 files+59 added−1 removed

  • tests:+54 added−0 removed
  • other:+5 added−1 removed

3 files+59 added−1 removed

modified:lib/request.js+4 added-1 removed
11 unmodified lines
12 , parseRange = require('range-parser')13 , parse = require('parseurl')14 , proxyaddr = require('proxy-addr')15 , mime = connect.mime;16var isIP = require('net').isIP;1718/**19 * Request prototype.20 */
433 unmodified lines
454455req.__defineGetter__('subdomains', function(){456 var host = this.host;457 var offset = this.app.get('subdomain offset');457 var subdomains = host.split('.').reverse();458 var subdomains = !isIP(host)459 ? host.split('.').reverse()460 : [host];461462 return subdomains.slice(offset);463});464
91 unmodified lines
modified:test/req.subdomains.js+54 added
modified:History.md+1 added
13.x2===34 * Support `X-Forwarded-Host` in `req.subdomains`5 * Support IP address host in `req.subdomains`6 * deps: connect@2.26.07 - deps: body-parser@~1.8.18 - deps: compression@~1.1.09 - deps: connect-timeout@~1.3.0
1741 unmodified lines