Skip to content

Commit 85f8c1c

Browse files
authored
Add note about HttpClientHandler (#4066)
* add note about httpclienthandler
1 parent a97f7ea commit 85f8c1c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

xml/System.Net.Http/HttpClientHandler.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@
3030
<format type="text/markdown"><![CDATA[
3131
3232
## Remarks
33-
The `HttpClientHandler` class and classes derived from it enable developers to configure a variety of options ranging from proxies to authentication.
33+
34+
The `HttpClientHandler` class and classes derived from it enable developers to configure a variety of options ranging from proxies to authentication.
3435
3536
### HttpClientHandler in .NET Core
3637
37-
Starting with .NET Core 2.1, the <xref:System.Net.Http.SocketsHttpHandler?displayProperty=nameWithType> class instead of `HttpClientHandler` provides the implementation used by higher-level HTTP networking APIs. You can configure your application to use `HttpClientHandler` instead in any of the following ways:
38+
Starting in .NET Core 2.1, the implementation of the `HttpClientHandler` class was changed to be based on the cross-platform HTTP protocol stack used by the <xref:System.Net.Http.SocketsHttpHandler?displayProperty=nameWithType> class. Prior to .NET Core 2.1, the `HttpClientHandler` class used older HTTP protocol stacks (<xref:System.Net.Http.WinHttpHandler> on Windows and `CurlHandler`, an internal class implemented on top of Linux's native libcurl component, on Linux).
39+
40+
You can configure your app to use the older HTTP protocol stacks in one of the following three ways:
3841
39-
- By calling the <xref:System.AppContext.SetSwitch%2A?displayProperty=nameWithType> method as follows:
42+
- Call the <xref:System.AppContext.SetSwitch%2A?displayProperty=nameWithType> method:
4043
4144
```csharp
4245
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
@@ -46,7 +49,7 @@ Starting with .NET Core 2.1, the <xref:System.Net.Http.SocketsHttpHandler?displa
4649
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", False)
4750
```
4851
49-
- By defining the `System.Net.Http.UseSocketsHttpHandler` switch in the *.netcore.runtimeconfig.json* configuration file:
52+
- Define the `System.Net.Http.UseSocketsHttpHandler` switch in the *.netcore.runtimeconfig.json* configuration file:
5053
5154
```json
5255
"runtimeOptions": {
@@ -56,7 +59,7 @@ Starting with .NET Core 2.1, the <xref:System.Net.Http.SocketsHttpHandler?displa
5659
}
5760
```
5861
59-
- By defining an environment variable named `DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER` and setting it to either `false` or 0.
62+
- Define an environment variable named `DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER` and set it to either `false` or **0**.
6063
6164
## Examples
6265
[!code-csharp[System.Net.Http.HttpClientHandler#1](~/samples/snippets/csharp/VS_Snippets_Misc/system.net.http.httpclienthandler/cs/source.cs#1)]

0 commit comments

Comments
 (0)