mitmproxy/test
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
..
bench fix some typos (#6728) 2024-03-11 08:19:36 +01:00
examples introduce new contentview API (#7623) 2025-04-21 14:56:58 +02:00
helper_tools Incorporate existing SNI into allow/ignore decision, fix #5064 (#7002) 2024-07-05 22:19:55 +00:00
mitmproxy Treat carriage return as whitespace in strutils.is_xml (#8243) 2026-05-21 19:15:31 +02:00
wg-test-client
__init__.py
conftest.py Run pyupgrade and improve f-strings (#7837) 2025-08-19 20:15:46 +02:00
filename_matching.py
individual_coverage.py 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
run-tests-offline.sh switch to uv (#7662) 2025-04-16 18:38:35 +02:00