mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-31 09:29:42 +00:00
Handle scripts that don't return a 200 status code
This was already being handled for async scripts, but for sync scripts, we'd log the error then proceed to try and execute the body (which would be some error message). This allows the header_callback to return a boolean to indicate whether or not the http client should continue to process the request or abort it.
This commit is contained in:
@@ -89,7 +89,7 @@ pub fn deinit(self: *Fetch) void {
|
||||
}
|
||||
}
|
||||
|
||||
fn httpHeaderDoneCallback(transfer: *Http.Transfer) !void {
|
||||
fn httpHeaderDoneCallback(transfer: *Http.Transfer) !bool {
|
||||
const self: *Fetch = @ptrCast(@alignCast(transfer.ctx));
|
||||
|
||||
if (transfer.getContentLength()) |cl| {
|
||||
@@ -133,6 +133,8 @@ fn httpHeaderDoneCallback(transfer: *Http.Transfer) !void {
|
||||
while (it.next()) |hdr| {
|
||||
try res._headers.append(hdr.name, hdr.value, self._page);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
fn httpDataCallback(transfer: *Http.Transfer, data: []const u8) !void {
|
||||
|
||||
Reference in New Issue
Block a user