mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-08 12:21:44 -04:00
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:
2 files changed
+2
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user