mitmproxy/mitmproxy
Aditya Raj 12a292c2e7
Treat carriage return as whitespace in strutils.is_xml (#8243)
* Treat carriage return as whitespace in strutils.is_xml

is_xml() skipped only tab, LF and space before checking for the
opening "<", so a response body that started with a leading CR
or CRLF (which is what HTTP frames look like, and what some
Windows-side XML producers emit) was not detected as XML.
The XML/HTML content view's auto-detection score then dropped
to 0 instead of the usual 0.4 for those bodies.

XML 1.0 §2.3 defines whitespace as (#x20 | #x9 | #xD | #xA), so
\r (0x0D) belongs in the skip set alongside the other three.
Adds the missing byte plus three assertions in the existing
test_is_xml: \r<foo and \r\n<foo are now recognised, and a
sanity check that \r\nfoo is still rejected.

* [autofix.ci] apply automated fixes

* simplify wording

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2026-05-21 19:15:31 +02:00
..
addons Fix LDAP Sanitization (#8178) 2026-04-12 21:14:46 +00:00
contentviews Add ZIP content view for issue #8051 (#8054) 2026-01-30 22:15:07 +01:00
contrib
coretypes Update ruff requirement from <=0.8.6,>=0.5.0 to >=0.5.0,<=0.9.4 (#7528) 2025-02-01 23:21:33 +00:00
io fix: add flush to buffered file handle (#7967) 2025-11-10 00:50:09 +00:00
net Fix uppercase scheme (#8174) 2026-04-12 14:03:14 +00:00
platform
proxy feat: Make TCP inactivity timeout configurable (#7910) 2025-11-11 12:27:39 +00:00
script
test Fix event loop leak when running tests (#7982) 2025-11-18 15:19:40 +01:00
tools mitmproxy 12.2.3 2026-05-12 13:02:14 +00:00
utils Treat carriage return as whitespace in strutils.is_xml (#8243) 2026-05-21 19:15:31 +02:00
__init__.py
addonmanager.py
certs.py Reduce generated certificate validity (#8203) 2026-05-11 14:08:05 +00:00
command.py Run pyupgrade and improve f-strings (#7837) 2025-08-19 20:15:46 +02:00
command_lexer.py
connection.py Use Python 3.13 for binaries (#7485) 2025-01-16 21:15:31 +00:00
ctx.py
dns.py Run pyupgrade and improve f-strings (#7837) 2025-08-19 20:15:46 +02:00
eventsequence.py
exceptions.py
flow.py
flowfilter.py web: misc improvements (#7706) 2025-05-12 19:31:18 +00:00
hooks.py
http.py Run pyupgrade and improve f-strings (#7837) 2025-08-19 20:15:46 +02:00
log.py
master.py Fix type for Master.opts to accept None (#7752) 2025-06-03 12:47:49 +02:00
options.py Add "local" mode to ‘--mode help’ command description (#7976) (#7977) 2025-11-14 21:15:17 +01:00
optmanager.py Add option name to parsing exceptions in optmanager (#8016) 2026-01-01 23:40:48 +00:00
py.typed
tcp.py
tls.py
types.py
udp.py
version.py reopen main for development 2026-05-12 13:02:14 +00:00
websocket.py