mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
cdp: set default username/passwd for authChallengeResponse
This commit is contained in:
@@ -280,8 +280,8 @@ fn continueWithAuth(cmd: anytype) !void {
|
|||||||
requestId: []const u8, // "INTERCEPT-{d}"
|
requestId: []const u8, // "INTERCEPT-{d}"
|
||||||
authChallengeResponse: struct {
|
authChallengeResponse: struct {
|
||||||
response: []const u8,
|
response: []const u8,
|
||||||
username: ?[]const u8 = null,
|
username: []const u8 = "",
|
||||||
password: ?[]const u8 = null,
|
password: []const u8 = "",
|
||||||
},
|
},
|
||||||
})) orelse return error.InvalidParams;
|
})) orelse return error.InvalidParams;
|
||||||
|
|
||||||
@@ -305,14 +305,14 @@ fn continueWithAuth(cmd: anytype) !void {
|
|||||||
// cancel the request, deinit the transfer on error.
|
// cancel the request, deinit the transfer on error.
|
||||||
errdefer transfer.abortAuthChallenge();
|
errdefer transfer.abortAuthChallenge();
|
||||||
|
|
||||||
const username = params.authChallengeResponse.username orelse "";
|
|
||||||
const password = params.authChallengeResponse.password orelse "";
|
|
||||||
|
|
||||||
// restart the request with the provided credentials.
|
// restart the request with the provided credentials.
|
||||||
// we need to duplicate the cre
|
// we need to duplicate the cre
|
||||||
const arena = transfer.arena.allocator();
|
const arena = transfer.arena.allocator();
|
||||||
transfer.updateCredentials(
|
transfer.updateCredentials(
|
||||||
try std.fmt.allocPrintZ(arena, "{s}:{s}", .{ username, password }),
|
try std.fmt.allocPrintZ(arena, "{s}:{s}", .{
|
||||||
|
params.authChallengeResponse.username,
|
||||||
|
params.authChallengeResponse.password,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
try bc.cdp.browser.http_client.process(transfer);
|
try bc.cdp.browser.http_client.process(transfer);
|
||||||
|
|||||||
Reference in New Issue
Block a user