mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-05 14:57:11 +00:00
Rework request interception for Zigdom
Zigdom broke request interception. It isn't zigdom specifically, but in zigdom we properly block the parser when executing a normal (not async, not defer) script. This does not work well with request interception, because an intercepted request isn't blocked on HTTP data, it's blocked on a message from CDP. Generally, neither our Page nor ScriptManager are CDP-aware. And, even if they were, it would be hard to break out of our parsing and return control to the CDP server. To fix this, we expand on the HTTP Client's basic awareness of CDP (via its extra_socket field). The HTTP client is now able to block until an intercepted request is continued/aborted/fulfilled. it does this by being able to ask the CDP client to read/process data. This does not yet work for intercepted authentication requests.
This commit is contained in:
@@ -90,12 +90,13 @@ pub fn poll(self: *Http, timeout_ms: u32) Client.PerformStatus {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn monitorSocket(self: *Http, socket: posix.socket_t) void {
|
||||
self.client.extra_socket = socket;
|
||||
pub fn addCDPClient(self: *Http, cdp_client: Client.CDPClient) void {
|
||||
std.debug.assert(self.client.cdp_client == null);
|
||||
self.client.cdp_client = cdp_client;
|
||||
}
|
||||
|
||||
pub fn unmonitorSocket(self: *Http) void {
|
||||
self.client.extra_socket = null;
|
||||
pub fn removeCDPClient(self: *Http) void {
|
||||
self.client.cdp_client = null;
|
||||
}
|
||||
|
||||
pub fn newConnection(self: *Http) !Connection {
|
||||
|
||||
Reference in New Issue
Block a user