changeset 18:d30118837c1a

dunno
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 30 Dec 2012 20:23:50 -0800
parents 3a1fb496b47d
children 4d9a2a2fb8c0
files wsgintegrate/match.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/wsgintegrate/match.py	Sun Dec 30 20:11:48 2012 -0800
+++ b/wsgintegrate/match.py	Sun Dec 30 20:23:50 2012 -0800
@@ -87,6 +87,10 @@
 
   def __init__(self, app, host, port=None):
     RequestMatch.__init__(self, app)
+    self.wildcard = False
+    if host.startswith('*.'):
+        self.wildcard = True
+        host = host[len('*.'):]
     self.host = host
     self.port = port
 
@@ -99,10 +103,8 @@
         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
+    if self.wildcard and host.endswith('.' + self.host):
+        return True # wildcard
     return host == self.host
 
 class MatchAuthorized(RequestMatch):