]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Handle the Content-Type header a little more appropriately: if it
authorFred Drake <fdrake@acm.org>
Tue, 12 Nov 2002 22:21:01 +0000 (22:21 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 12 Nov 2002 22:21:01 +0000 (22:21 +0000)
contains options, drop them to get the major/minor content type.
Modified from the supplied patch to support more whitespace variation.
Closes SF patch #613605.

Tools/webchecker/webchecker.py

index 470b15a101a4cb964a2018eedb7a283253a66218..b4017a8d4e82937b0d8f0aa20c82bd1d3189695f 100755 (executable)
@@ -544,6 +544,9 @@ class Checker:
     def checkforhtml(self, info, url):
         if info.has_key('content-type'):
             ctype = string.lower(info['content-type'])
+            if ';' in ctype:
+                # handle content-type: text/html; charset=iso8859-1 :
+                ctype = ctype.split(';', 1)[0].strip()
         else:
             if url[-1:] == "/":
                 return 1