mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-03 19:27:14 +00:00
charset detection: ignore case when searching in HTML (#4785)
This commit is contained in:
parent
d5bba9878b
commit
4e5a0ae71d
1 changed files with 2 additions and 2 deletions
|
|
@ -408,13 +408,13 @@ class Message(serializable.Serializable):
|
|||
if "json" in self.headers.get("content-type", ""):
|
||||
enc = "utf8"
|
||||
if not enc:
|
||||
meta_charset = re.search(rb"""<meta[^>]+charset=['"]?([^'">]+)""", content)
|
||||
meta_charset = re.search(rb"""<meta[^>]+charset=['"]?([^'">]+)""", content, re.IGNORECASE)
|
||||
if meta_charset:
|
||||
enc = meta_charset.group(1).decode("ascii", "ignore")
|
||||
if not enc:
|
||||
if "text/css" in self.headers.get("content-type", ""):
|
||||
# @charset rule must be the very first thing.
|
||||
css_charset = re.match(rb"""@charset "([^"]+)";""", content)
|
||||
css_charset = re.match(rb"""@charset "([^"]+)";""", content, re.IGNORECASE)
|
||||
if css_charset:
|
||||
enc = css_charset.group(1).decode("ascii", "ignore")
|
||||
if not enc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue