mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-09-15 07:19:20 -04:00
basic validation without preflighting
This commit is contained in:
2 files changed
+65
-3
No files matched your search
@@ -1085,7 +1085,7 @@ pub fn resumeAfterCors(self: *Client, transfer: *Transfer) !void {
|
||||
return self.pipeline(transfer, .after_cors);
|
||||
}
|
||||
|
||||
fn findHeader(headers: []const http.Header, name: []const u8) ?[]const u8 {
|
||||
pub fn findHeader(headers: []const http.Header, name: []const u8) ?[]const u8 {
|
||||
for (headers) |hdr| {
|
||||
if (std.ascii.eqlIgnoreCase(hdr.name, name)) {
|
||||
return hdr.value;
|
||||
@@ -1690,6 +1690,16 @@ fn processOneMessage(self: *Client, msg: http.Handles.MultiMessage, transfer: *T
|
||||
|
||||
try transfer.materializeResponse(msg.conn, .{});
|
||||
|
||||
// Validate the headers for the response with CORS.
|
||||
if (transfer._cors_cross_origin) {
|
||||
CorsGate.validateResponse(transfer) catch |err| {
|
||||
self.removeConn(msg.conn);
|
||||
transfer._conn = null;
|
||||
transfer.failAsync(err);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
// Latency is only meaningful for responses that hit the network (cache
|
||||
// and synthetic responses never reach processOneMessage).
|
||||
if (!transfer.req.internal) {
|
||||
|
||||
Reference in new issue
Block a user