summaryrefslogtreecommitdiffstats
path: root/Tools/webchecker
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-11-12 22:19:34 (GMT)
committerFred Drake <fdrake@acm.org>2002-11-12 22:19:34 (GMT)
commit0b9e3f750cc91e83d9614dd941545a8b29fa248a (patch)
treefaa30477a95fa00cd81624436e84a80480ddd89f /Tools/webchecker
parentb9099c3df495d4bf0090d7a751325343852b61db (diff)
downloadcpython-0b9e3f750cc91e83d9614dd941545a8b29fa248a.zip
cpython-0b9e3f750cc91e83d9614dd941545a8b29fa248a.tar.gz
cpython-0b9e3f750cc91e83d9614dd941545a8b29fa248a.tar.bz2
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.
Diffstat (limited to 'Tools/webchecker')
-rwxr-xr-xTools/webchecker/webchecker.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/webchecker/webchecker.py b/Tools/webchecker/webchecker.py
index fd7f578..e8d0ed7 100755
--- a/Tools/webchecker/webchecker.py
+++ b/Tools/webchecker/webchecker.py
@@ -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