Skip to content

Commit d13b64f

Browse files
kevinoidgewarren
andauthored
HttpClient.DefaultProxy environment variable format (#4315)
* HttpClient.DefaultProxy environment variable format Include additional information about the supported formats for HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY environment variables based on the handling in [HttpEnvironmentProxy.TryCreate] and [HttpEnvironmentProxy.GetUriFromString]. The lack of https support (see dotnet/runtime#31113) is specifically noted since it may catch users by surprise (as it did for me) and is difficult to debug due to the lack of diagnostic logging. [HttpEnvironmentProxy.GetUriFromString]: https://github.com/dotnet/runtime/blob/v5.0.0-preview.4.20251.6/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpEnvironmentProxy.cs#L136 [HttpEnvironmentProxy.TryCreate]: https://github.com/dotnet/runtime/blob/v5.0.0-preview.4.20251.6/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpEnvironmentProxy.Unix.cs#L16 Signed-off-by: Kevin Locke <[email protected]> * Apply suggestions from gewarren Co-authored-by: Genevieve Warren <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent df1360c commit d13b64f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

xml/System.Net.Http/HttpClient.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,14 @@ The default instance returned by this property will initialize following a diffe
427427
* **For Linux:** Reads proxy configuration from environment variables or, in case those are not defined, this property initializes a non-configured instance that bypasses all addresses.
428428
429429
The environment variables used for `DefaultProxy` initialization on Windows and Unix-based platforms are:
430-
* HTTP_PROXY: the hostname or IP address of the proxy server used on HTTP requests.
431-
* HTTPS_PROXY: the hostname or IP address of the proxy server used on HTTPS requests.
432-
* ALL_PROXY: the hostname or IP address of the proxy server used on HTTP and/or HTTPS requests in case HTTP_PROXY and/or HTTPS_PROXY are not defined.
430+
* HTTP_PROXY: the proxy server used on HTTP requests.
431+
* HTTPS_PROXY: the proxy server used on HTTPS requests.
432+
* ALL_PROXY: the proxy server used on HTTP and/or HTTPS requests in case HTTP_PROXY and/or HTTPS_PROXY are not defined.
433433
* NO_PROXY: a comma-separated list of hostnames that should be excluded from proxying.
434434
435+
On systems where environment variables are case-sensitive, the variable names may be all lowercase or all uppercase. The lowercase names are checked first.
436+
437+
The proxy server may be a hostname or IP address, optionally followed by a colon and port number, or it may be an http URL, optionally including a username and password for proxy authentication. The URL must be start with `http`, not `https`, and cannot include any text after the hostname, IP, or port.
435438
]]></format>
436439
</remarks>
437440
<exception cref="T:System.ArgumentNullException">The value passed cannot be <see langword="null" />.</exception>

0 commit comments

Comments
 (0)