mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 12:44:43 +00:00
Merge pull request #1758 from lightpanda-io/http-auth-challenge
http: handle auth challenge for non-proxy auth
This commit is contained in:
@@ -377,6 +377,10 @@ pub const Connection = struct {
|
|||||||
try libcurl.curl_easy_setopt(self.easy, .proxy_user_pwd, creds.ptr);
|
try libcurl.curl_easy_setopt(self.easy, .proxy_user_pwd, creds.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn setCredentials(self: *const Connection, creds: [:0]const u8) !void {
|
||||||
|
try libcurl.curl_easy_setopt(self.easy, .user_pwd, creds.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn setCallbacks(
|
pub fn setCallbacks(
|
||||||
self: *const Connection,
|
self: *const Connection,
|
||||||
comptime header_cb: libcurl.CurlHeaderFunction,
|
comptime header_cb: libcurl.CurlHeaderFunction,
|
||||||
|
|||||||
@@ -718,7 +718,11 @@ fn makeRequest(self: *Client, conn: *Net.Connection, transfer: *Transfer) anyerr
|
|||||||
|
|
||||||
// add credentials
|
// add credentials
|
||||||
if (req.credentials) |creds| {
|
if (req.credentials) |creds| {
|
||||||
try conn.setProxyCredentials(creds);
|
if (transfer._auth_challenge != null and transfer._auth_challenge.?.source == .proxy) {
|
||||||
|
try conn.setProxyCredentials(creds);
|
||||||
|
} else {
|
||||||
|
try conn.setCredentials(creds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ pub const CurlOption = enum(c.CURLoption) {
|
|||||||
cookie = c.CURLOPT_COOKIE,
|
cookie = c.CURLOPT_COOKIE,
|
||||||
private = c.CURLOPT_PRIVATE,
|
private = c.CURLOPT_PRIVATE,
|
||||||
proxy_user_pwd = c.CURLOPT_PROXYUSERPWD,
|
proxy_user_pwd = c.CURLOPT_PROXYUSERPWD,
|
||||||
|
user_pwd = c.CURLOPT_USERPWD,
|
||||||
header_data = c.CURLOPT_HEADERDATA,
|
header_data = c.CURLOPT_HEADERDATA,
|
||||||
header_function = c.CURLOPT_HEADERFUNCTION,
|
header_function = c.CURLOPT_HEADERFUNCTION,
|
||||||
write_data = c.CURLOPT_WRITEDATA,
|
write_data = c.CURLOPT_WRITEDATA,
|
||||||
@@ -512,6 +513,7 @@ pub fn curl_easy_setopt(easy: *Curl, comptime option: CurlOption, value: anytype
|
|||||||
.accept_encoding,
|
.accept_encoding,
|
||||||
.custom_request,
|
.custom_request,
|
||||||
.cookie,
|
.cookie,
|
||||||
|
.user_pwd,
|
||||||
.proxy_user_pwd,
|
.proxy_user_pwd,
|
||||||
.copy_post_fields,
|
.copy_post_fields,
|
||||||
=> blk: {
|
=> blk: {
|
||||||
|
|||||||
Reference in New Issue
Block a user