Mercurial > hg > wsgintegrate
changeset 16:b1a5abacf1f3
wildcard host matching
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 28 Aug 2012 21:53:55 -0700 |
parents | 1a7bbd97dda4 |
children | 3a1fb496b47d |
files | wsgintegrate/match.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/wsgintegrate/match.py Thu Nov 17 11:49:41 2011 -0800 +++ b/wsgintegrate/match.py Tue Aug 28 21:53:55 2012 -0700 @@ -89,13 +89,18 @@ RequestMatch.__init__(self, app) self.host = host self.port = port + def condition(self, environ): host = environ['HTTP_HOST'] port = None if ':' in host: - host, port = host.rsplit(':', 1) + host, port = host.rsplit(':', 1) if self.port and port != self.port: return False + if host.startswith('*.'): + # wildcard + if host.endswith('.' + self.host[len('*.'):]): + return True return host == self.host class MatchAuthorized(RequestMatch):