# HG changeset patch # User Atul Varma # Date 1241225408 25200 # Node ID ef9ae587a0c8219f942aae9575ff6ea7d833e649 # Parent 0b8c3a21335cbc5c159fdbe59232b2f2110fea87 Fixed misbehaving redirect URL matching and added a robots.txt. diff -r 0b8c3a21335c -r ef9ae587a0c8 openwebchat.py --- a/openwebchat.py Fri May 01 17:38:44 2009 -0700 +++ b/openwebchat.py Fri May 01 17:50:08 2009 -0700 @@ -21,6 +21,8 @@ KEEP_ALIVE_TIMEOUT = int(DEFAULT_TIMEOUT) MAX_MESSAGE_SIZE = 8192 +ROBOTS_TXT = "User-agent: *\r\nDisallow: /" + class Conversations(object): def __init__(self): self._convs = weakref.WeakValueDictionary() @@ -63,7 +65,7 @@ class OpenWebChatServer(object): QUERYSTRING_TEMPLATE = re.compile('([^\?]*)\?(.*)') - REDIRECT_TEMPLATE = re.compile('\/([A-Za-z0-9_]+)') + REDIRECT_TEMPLATE = re.compile('\/([A-Za-z0-9_]+)$') URL_TEMPLATE = re.compile('\/([A-Za-z0-9_]+)/(.*)') BOUNDARY = "'''" @@ -237,6 +239,8 @@ code = 301, additional_headers = {'Location': newpath} ) + elif req_parts[1] == '/robots.txt': + yield self._until_http_response_sent(ROBOTS_TXT) else: yield self._until_http_response_sent('not found', code = 404)