# HG changeset patch # User Jeff Hammel # Date 1346216035 25200 # Node ID b1a5abacf1f3c3dfd341ea4cd1954fa5ef5f419e # Parent 1a7bbd97dda4e69220e9cd3f716095c78cd11492 wildcard host matching diff -r 1a7bbd97dda4 -r b1a5abacf1f3 wsgintegrate/match.py --- 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):