interface: add custom proxy#47
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds per-client custom proxy configuration across the public client API, interface options, backend implementations, and backend test fixtures.
Changes:
- Introduces
CustomProxyand replaces the boolean default-proxy flag withProxyOptions. - Implements proxy handling for curl, reqwest, WinHTTP, NSURLSession, and no/custom handling for WinRT.
- Adds proxy backend tests and refactors shared Hyper test fixture setup.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/client/proxy.rs |
Adds public custom proxy builder type. |
src/client/builder.rs |
Adds custom_proxy and updates no_proxy. |
src/client.rs |
Exports CustomProxy. |
README.md |
Moves WinHTTP to completed MVP backends. |
nyquest-interface/src/client/options.rs |
Adds ProxyOptions to client configuration. |
nyquest-interface/src/client.rs |
Exports ProxyOptions. |
nyquest-backend-tests/src/lib.rs |
Refactors shared fixture server setup. |
nyquest-backend-tests/src/hyper_fixture_collection.rs |
Extracts reusable Hyper fixture collection. |
nyquest-backend-tests/src/fixtures/client_options/proxy.rs |
Adds proxy behavior tests. |
nyquest-backend-tests/src/fixtures/client_options.rs |
Registers proxy tests. |
Cargo.lock |
Updates platform dependency lock entries. |
backends/winrt/src/response.rs |
Moves stream reader state out of common response. |
backends/winrt/src/client.rs |
Adapts WinRT proxy option handling. |
backends/winrt/src/blocking/timer_ext.rs |
Updates Windows async blocking call. |
backends/winrt/src/blocking.rs |
Moves blocking reader state into blocking response. |
backends/winrt/src/async/read_task.rs |
Adds async read state machine. |
backends/winrt/src/async.rs |
Uses new WinRT async read task. |
backends/winrt/Cargo.toml |
Updates Windows crate versions. |
backends/winhttp/src/session.rs |
Passes proxy options to session creation. |
backends/winhttp/src/handle/session.rs |
Adds WinHTTP proxy option mapping. |
backends/winhttp/src/async/threadpool.rs |
Removes custom threadpool helper. |
backends/winhttp/src/async/client.rs |
Uses windows-threading for async setup work. |
backends/winhttp/src/async.rs |
Removes deleted threadpool module. |
backends/winhttp/Cargo.toml |
Updates Windows dependencies and adds windows-threading. |
backends/reqwest/src/client.rs |
Adds reqwest proxy option mapping. |
backends/nsurlsession/src/response.rs |
Adjusts Objective-C API calls for updated bindings. |
backends/nsurlsession/src/datatask/delegate.rs |
Adjusts Objective-C API calls for updated bindings. |
backends/nsurlsession/src/client.rs |
Adds NSURLSession proxy dictionary support. |
backends/nsurlsession/src/blocking.rs |
Adjusts Objective-C API calls for updated bindings. |
backends/nsurlsession/src/async.rs |
Adjusts Objective-C API calls for updated bindings. |
backends/nsurlsession/Cargo.toml |
Updates Objective-C Foundation dependency/features. |
backends/curl/src/request.rs |
Adds curl proxy option setup. |
backends/curl/src/curl_ng/easy/opt.rs |
Adds curl proxy-related option wrappers. |
Comments suppressed due to low confidence (2)
backends/reqwest/src/client.rs:110
- Invalid HTTPS proxy URLs are also silently ignored, which leaves HTTPS traffic without the requested custom proxy while the client still builds successfully. Propagate
Proxy::httpsfailures whenproxy_url_for_httpsis provided so invalid per-client proxy settings are not accepted silently.
if let Some(Ok(proxy_https)) = proxy_url_for_https.as_deref().map(Proxy::https) {
builder = builder.proxy(proxy_https.no_proxy(no_proxy));
}
backends/nsurlsession/src/client.rs:60
- A provided HTTPS proxy URL that fails parsing (including otherwise valid URLs without an explicit port) is silently dropped, so HTTPS requests will not use the caller's requested proxy. Treat an invalid
proxy_url_for_httpsas a client build error or derive the default port from the scheme rather than ignoring it.
if let Some(https_proxy) =
proxy_url_for_https.and_then(|url| parse_proxy_host_port(&url))
{
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+41
to
+48
| ProxyOptions::Default => unsafe { | ||
| WinHttpOpen( | ||
| user_agent_ptr, | ||
| WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, | ||
| std::ptr::null(), | ||
| std::ptr::null(), | ||
| flags, | ||
| ) |
Comment on lines
+105
to
+108
| if let Ok(proxy_http) = Proxy::http(&**proxy_url_for_http) { | ||
| builder = builder.proxy(proxy_http.no_proxy(no_proxy.clone())); | ||
| } | ||
| if let Some(Ok(proxy_https)) = proxy_url_for_https.as_deref().map(Proxy::https) { |
Comment on lines
+57
to
+62
| raw.as_mut().set_proxy(&**proxy_url_for_http)?; | ||
| if proxy_url_for_https.is_some() { | ||
| // TODO: curl doesn't have a separate option for HTTPS proxy. | ||
| raw.as_mut().set_http_proxy_tunnel(true)?; | ||
| raw.as_mut().set_suppress_connect_headers(true)?; | ||
| } |
Comment on lines
+44
to
+45
| if let Some(http_proxy) = parse_proxy_host_port(&proxy_url_for_http) { | ||
| let dict = NSMutableDictionary::from_retained_objects( |
Owner
Author
|
@copilot apply changes based on the comments in this thread |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #41