]> granicus.if.org Git - python/commitdiff
Handle the Content-Type header a little more appropriately: if it
authorFred Drake <fdrake@acm.org>
Tue, 12 Nov 2002 22:19:34 +0000 (22:19 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 12 Nov 2002 22:19:34 +0000 (22:19 +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 fd7f578b31badc3d74f67a43d71bec60ca47cb2f..e8d0ed746fe0932c3e7b4a65fe8718d2a936c77f 100755 (executable)
@@ -544,6 +544,9 @@ class Checker:
     def checkforhtml(self, info, url):
         if info.has_key('content-type'):
             ctype = cgi.parse_header(info['content-type'])[0].lower()
+            if ';' in ctype:
+                # handle content-type: text/html; charset=iso8859-1 :
+                ctype = ctype.split(';', 1)[0].strip()
         else:
             if url[-1:] == "/":
                 return 1