http: CDP ignore invalid content-type message

Saw a site return "Content-Type: charset=UTF-8;charset=UTF-8" on scrape. Not a
valid header and it correctly fails to parse. Except...CDP fails to RI on these
since it tries to parse and bubbles. Safe to swallow this error here and
continue with the response serialization.
This commit is contained in:
Karl Seguin committed 2026-09-29 15:46:55 +08:00
1 parent f086b75d54
commit 68ff1a4322
2 files changed
+2 -3

No files matched your search

+1 -2
View File
@@ -1097,8 +1097,7 @@ pub const BrowserContext = struct {
// for well known content-type.
.must_encode = blk: {
if (msg.transfer.contentType()) |ct| {
const mime = try Mime.parse(ct);
const mime = Mime.parse(ct) catch break :blk true;
if (!mime.isText()) {
break :blk true;
}
+1 -1
View File
@@ -615,7 +615,7 @@ const ResponseWriter = struct {
{
const mime: Mime = blk: {
if (transfer.contentType()) |ct| {
break :blk try Mime.parse(ct);
break :blk Mime.parse(ct) catch .unknown;
}
break :blk .unknown;
};