[wwwsearch-commits] r19798 - wwwsearch/ClientCookie/trunk/ClientCookie

jjlee at codespeak.net jjlee at codespeak.net
Sat Nov 12 18:55:25 CET 2005


Author: jjlee
Date: Sat Nov 12 18:55:24 2005
New Revision: 19798

Modified:
   wwwsearch/ClientCookie/trunk/ClientCookie/_HeadersUtil.py
Log:
Check URL file extension more carefully

Modified: wwwsearch/ClientCookie/trunk/ClientCookie/_HeadersUtil.py
==============================================================================
--- wwwsearch/ClientCookie/trunk/ClientCookie/_HeadersUtil.py	(original)
+++ wwwsearch/ClientCookie/trunk/ClientCookie/_HeadersUtil.py	Sat Nov 12 18:55:24 2005
@@ -9,7 +9,7 @@
 
 """
 
-import re, string
+import os, re, string, urlparse
 from types import StringType
 try:
     from types import UnicodeType
@@ -32,8 +32,8 @@
     """
     if not ct_headers:
         # guess
-        return (url.endswith('.htm') or url.endswith('.html') or
-                url.endswith('.xhtml'))
+        ext = os.path.splitext(urlparse.urlparse(url)[2])[1]
+        return ext in ['.htm', '.html', '.xhtml']
     # use first header
     ct = split_header_words(ct_headers)[0][0][0]
     return ct in [


More information about the wwwsearch-commits mailing list