mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-29 15:13:28 +00:00 
			
		
		
		
	http: add creds into request
This commit is contained in:
		| @@ -325,6 +325,11 @@ fn makeRequest(self: *Client, handle: *Handle, transfer: *Transfer) !void { | ||||
|         } | ||||
|  | ||||
|         try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_PRIVATE, transfer)); | ||||
|  | ||||
|         // add credentials | ||||
|         if (req.credentials) |creds| { | ||||
|             try errorCheck(c.curl_easy_setopt(easy, c.CURLOPT_PROXYUSERPWD, creds.ptr)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Once soon as this is called, our "perform" loop is responsible for | ||||
| @@ -542,6 +547,7 @@ pub const Request = struct { | ||||
|     body: ?[]const u8 = null, | ||||
|     cookie_jar: *CookieJar, | ||||
|     resource_type: ResourceType, | ||||
|     credentials: ?[:0]const u8 = null, | ||||
|  | ||||
|     // arbitrary data that can be associated with this request | ||||
|     ctx: *anyopaque = undefined, | ||||
| @@ -633,6 +639,10 @@ pub const Transfer = struct { | ||||
|         self.req.url = url; | ||||
|     } | ||||
|  | ||||
|     pub fn updateCredentials(self: *Transfer, userpwd: [:0]const u8) void { | ||||
|         self.req.credentials = userpwd; | ||||
|     } | ||||
|  | ||||
|     pub fn replaceRequestHeaders(self: *Transfer, allocator: Allocator, headers: []const Http.Header) !void { | ||||
|         self.req.headers.deinit(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Pierre Tachoire
					Pierre Tachoire