mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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.
This commit is contained in:
parent
b9099c3df4
commit
0b9e3f750c
1 changed files with 3 additions and 0 deletions
|
|
@ -544,6 +544,9 @@ class Checker:
|
||||||
def checkforhtml(self, info, url):
|
def checkforhtml(self, info, url):
|
||||||
if info.has_key('content-type'):
|
if info.has_key('content-type'):
|
||||||
ctype = cgi.parse_header(info['content-type'])[0].lower()
|
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:
|
else:
|
||||||
if url[-1:] == "/":
|
if url[-1:] == "/":
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue