Skip to content

Commit 86367cc

Browse files
author
fdrake
committed
Handle the Content-Type header a little more appropriately: if it
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. git-svn-id: http://svn.python.org/projects/python/trunk@29639 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 717c60d commit 86367cc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Tools/webchecker/webchecker.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ def openpage(self, url_pair):
544544
def checkforhtml(self, info, url):
545545
if info.has_key('content-type'):
546546
ctype = cgi.parse_header(info['content-type'])[0].lower()
547+
if ';' in ctype:
548+
# handle content-type: text/html; charset=iso8859-1 :
549+
ctype = ctype.split(';', 1)[0].strip()
547550
else:
548551
if url[-1:] == "/":
549552
return 1

0 commit comments

Comments
 (0)