Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 852d40e

Browse files
committed
Expose SocketsHttpHandler
- Renames ManagedHandler to SocketsHttpHandler - Moves a bunch of files around accordingly - Updates System.Net.WebSockets.Client to use SocketsHttpHandler directly - Updates System.Net.Http's tests with a reflection-based rather than TLS-based method for instantiating an HttpClientHandler backed by a SocketsHttpHandler.
1 parent d374be8 commit 852d40e

File tree

64 files changed

+394
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+394
-495
lines changed

src/System.Net.Http/ref/System.Net.Http.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,28 @@ public ReadOnlyMemoryContent(System.ReadOnlyMemory<byte> content) { }
236236
protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) => throw null;
237237
protected internal override bool TryComputeLength(out long length) => throw null;
238238
}
239+
public sealed class SocketsHttpHandler : HttpMessageHandler
240+
{
241+
public SocketsHttpHandler() { }
242+
public bool AllowAutoRedirect { get { throw null; } set { } }
243+
public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } }
244+
public System.Net.CookieContainer CookieContainer { get { throw null; } set { } }
245+
public System.Net.ICredentials Credentials { get { throw null; } set { } }
246+
public System.Net.ICredentials DefaultProxyCredentials { get { throw null; } set { } }
247+
public int MaxAutomaticRedirections { get { throw null; } set { } }
248+
public int MaxConnectionsPerServer { get { throw null; } set { } }
249+
public int MaxResponseHeadersLength { get { throw null; } set { } }
250+
public bool PreAuthenticate { get { throw null; } set { } }
251+
public System.TimeSpan PooledConnectionIdleTimeout { get { throw null; } set { } }
252+
public System.TimeSpan PooledConnectionLifetime { get { throw null; } set { } }
253+
public System.Collections.Generic.IDictionary<string, object> Properties { get { throw null; } }
254+
public System.Net.IWebProxy Proxy { get { throw null; } set { } }
255+
public System.Net.Security.SslClientAuthenticationOptions SslOptions { get { throw null; } set { } }
256+
public bool UseCookies { get { throw null; } set { } }
257+
public bool UseProxy { get { throw null; } set { } }
258+
protected override void Dispose(bool disposing) { }
259+
protected internal override System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; }
260+
}
239261
public partial class StreamContent : System.Net.Http.HttpContent
240262
{
241263
public StreamContent(System.IO.Stream content) { }

src/System.Net.Http/ref/System.Net.Http.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<ProjectReference Include="..\..\System.Threading.Tasks\ref\System.Threading.Tasks.csproj" />
1717
<ProjectReference Include="..\..\System.IO\ref\System.IO.csproj" />
1818
<ProjectReference Include="..\..\System.Net.Primitives\ref\System.Net.Primitives.csproj" />
19+
<ProjectReference Include="..\..\System.Net.Security\ref\System.Net.Security.csproj" />
1920
<ProjectReference Include="..\..\System.Security.Cryptography.X509Certificates\ref\System.Security.Cryptography.X509Certificates.csproj" />
2021
<ProjectReference Include="..\..\System.Text.Encoding\ref\System.Text.Encoding.csproj" />
2122
</ItemGroup>

src/System.Net.Http/src/ILLinkTrim.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
<assembly fullname="System.Net.Http">
33
<!-- Anonymous types are used with DiagnosticSource logging and subscribers reflect over those, calling their public getters. -->
44
<type fullname="*f__AnonymousType*" />
5-
6-
<!-- TODO #23166: Remove once exposed in contract -->
7-
<type fullname="System.Net.Http.ManagedHandler" />
85
</assembly>
9-
</linker>
6+
</linker>

src/System.Net.Http/src/System.Net.Http.csproj

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -121,42 +121,42 @@
121121
<Link>Common\System\Net\Logging\NetEventSource.Common.cs</Link>
122122
</Compile>
123123
</ItemGroup>
124-
<!-- Managed HttpClientHandler implementation -->
124+
<!-- SocketsHttpHandler implementation -->
125125
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
126-
<Compile Include="System\Net\Http\Managed\AuthenticateAndRedirectHandler.cs" />
127-
<Compile Include="System\Net\Http\Managed\AuthenticationHelper.Basic.cs" />
128-
<Compile Include="System\Net\Http\Managed\AuthenticationHelper.Digest.cs" />
129-
<Compile Include="System\Net\Http\Managed\ChunkedEncodingReadStream.cs" />
130-
<Compile Include="System\Net\Http\Managed\ChunkedEncodingWriteStream.cs" />
131-
<Compile Include="System\Net\Http\Managed\ConnectHelper.cs" />
132-
<Compile Include="System\Net\Http\Managed\ConnectionCloseReadStream.cs" />
133-
<Compile Include="System\Net\Http\Managed\ContentLengthReadStream.cs" />
134-
<Compile Include="System\Net\Http\Managed\ContentLengthWriteStream.cs" />
135-
<Compile Include="System\Net\Http\Managed\CookieHandler.cs" />
136-
<Compile Include="System\Net\Http\Managed\DecompressionHandler.cs" />
137-
<Compile Include="System\Net\Http\Managed\EmptyReadStream.cs" />
138-
<Compile Include="System\Net\Http\Managed\HttpConnection.cs" />
139-
<Compile Include="System\Net\Http\Managed\HttpConnectionContent.cs" />
140-
<Compile Include="System\Net\Http\Managed\HttpConnectionHandler.cs" />
141-
<Compile Include="System\Net\Http\Managed\HttpConnectionKey.cs" />
142-
<Compile Include="System\Net\Http\Managed\HttpConnectionPool.cs" />
143-
<Compile Include="System\Net\Http\Managed\HttpConnectionPools.cs" />
144-
<Compile Include="System\Net\Http\Managed\HttpConnectionSettings.cs" />
145-
<Compile Include="System\Net\Http\Managed\HttpContentDuplexStream.cs" />
146-
<Compile Include="System\Net\Http\Managed\HttpContentReadStream.cs" />
147-
<Compile Include="System\Net\Http\Managed\HttpContentStream.cs" />
148-
<Compile Include="System\Net\Http\Managed\HttpContentWriteStream.cs" />
149-
<Compile Include="System\Net\Http\Managed\HttpProxyConnectionHandler.cs" />
150-
<Compile Include="System\Net\Http\Managed\ManagedHandler.cs" />
151-
<Compile Include="System\Net\Http\Managed\RawConnectionStream.cs" />
126+
<Compile Include="System\Net\Http\SocketsHttpHandler\AuthenticateAndRedirectHandler.cs" />
127+
<Compile Include="System\Net\Http\SocketsHttpHandler\AuthenticationHelper.Basic.cs" />
128+
<Compile Include="System\Net\Http\SocketsHttpHandler\AuthenticationHelper.Digest.cs" />
129+
<Compile Include="System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs" />
130+
<Compile Include="System\Net\Http\SocketsHttpHandler\ChunkedEncodingWriteStream.cs" />
131+
<Compile Include="System\Net\Http\SocketsHttpHandler\ConnectHelper.cs" />
132+
<Compile Include="System\Net\Http\SocketsHttpHandler\ConnectionCloseReadStream.cs" />
133+
<Compile Include="System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs" />
134+
<Compile Include="System\Net\Http\SocketsHttpHandler\ContentLengthWriteStream.cs" />
135+
<Compile Include="System\Net\Http\SocketsHttpHandler\CookieHandler.cs" />
136+
<Compile Include="System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs" />
137+
<Compile Include="System\Net\Http\SocketsHttpHandler\EmptyReadStream.cs" />
138+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnection.cs" />
139+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionContent.cs" />
140+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionHandler.cs" />
141+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionKey.cs" />
142+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionPool.cs" />
143+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionPools.cs" />
144+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpConnectionSettings.cs" />
145+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpContentDuplexStream.cs" />
146+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpContentReadStream.cs" />
147+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpContentStream.cs" />
148+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpContentWriteStream.cs" />
149+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpProxyConnectionHandler.cs" />
150+
<Compile Include="System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs" />
151+
<Compile Include="System\Net\Http\SocketsHttpHandler\RawConnectionStream.cs" />
152152
</ItemGroup>
153-
<!-- Managed HttpClientHandler platform parts -->
153+
<!-- SocketsHttpHandler platform parts -->
154154
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' And '$(TargetGroup)' == 'netcoreapp'">
155-
<Compile Include="System\Net\Http\Managed\HttpProxyConnectionHandler.Unix.cs" />
156-
<Compile Include="System\Net\Http\Managed\HttpEnvironmentProxy.cs" />
155+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpProxyConnectionHandler.Unix.cs" />
156+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpEnvironmentProxy.cs" />
157157
</ItemGroup>
158158
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == 'netcoreapp'">
159-
<Compile Include="System\Net\Http\Managed\HttpProxyConnectionHandler.Windows.cs" />
159+
<Compile Include="System\Net\Http\SocketsHttpHandler\HttpProxyConnectionHandler.Windows.cs" />
160160
</ItemGroup>
161161
<!-- Common -->
162162
<ItemGroup>
@@ -187,7 +187,7 @@
187187
<Link>Common\System\Net\Mail\WhitespaceReader.cs</Link>
188188
</Compile>
189189
</ItemGroup>
190-
<!-- WinHTTP implementation -->
190+
<!-- WinHttpHandler implementation -->
191191
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'uap'">
192192
<Compile Include="System\Net\Http\HttpClientHandler.Core.cs" />
193193
<Compile Include="System\Net\Http\HttpClientHandler.Windows.cs" />
@@ -206,19 +206,19 @@
206206
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'uap'">
207207
<Compile Include="@(CompileItem)" />
208208
</ItemGroup>
209-
<!-- Unix -->
209+
<!-- CurlHandler implementation -->
210210
<PropertyGroup Condition=" '$(TargetsUnix)' == 'true' ">
211211
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
212212
</PropertyGroup>
213213
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
214214
<Compile Include="System\Net\Http\HttpClientHandler.Core.cs" />
215215
<Compile Include="System\Net\Http\HttpClientHandler.Unix.cs" />
216-
<Compile Include="System\Net\Http\Unix\CurlHandler.cs" />
217-
<Compile Include="System\Net\Http\Unix\CurlHandler.EasyRequest.cs" />
218-
<Compile Include="System\Net\Http\Unix\CurlHandler.MultiAgent.cs" />
219-
<Compile Include="System\Net\Http\Unix\CurlException.cs" />
220-
<Compile Include="System\Net\Http\Unix\CurlHandler.CurlResponseMessage.cs" />
221-
<Compile Include="System\Net\Http\Unix\CurlResponseHeaderReader.cs" />
216+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.cs" />
217+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.EasyRequest.cs" />
218+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.MultiAgent.cs" />
219+
<Compile Include="System\Net\Http\CurlHandler\CurlException.cs" />
220+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.CurlResponseMessage.cs" />
221+
<Compile Include="System\Net\Http\CurlHandler\CurlResponseHeaderReader.cs" />
222222
<Compile Include="$(CommonPath)\System\StrongToWeakReference.cs">
223223
<Link>Common\Interop\Unix\StrongToWeakReference.cs</Link>
224224
</Compile>
@@ -377,11 +377,11 @@
377377
<Compile Include="$(CommonPath)\System\Net\Security\CertificateValidation.Unix.cs">
378378
<Link>Common\System\Net\Security\CertificateValidation.Unix.cs</Link>
379379
</Compile>
380-
<Compile Include="System\Net\Http\Unix\CurlHandler.ClientCertificateProvider.cs" />
381-
<Compile Include="System\Net\Http\Unix\CurlHandler.SslProvider.cs" />
380+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.ClientCertificateProvider.cs" />
381+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.SslProvider.Linux.cs" />
382382
</ItemGroup>
383383
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' ">
384-
<Compile Include="System\Net\Http\OSX\CurlHandler.SslProvider.cs" />
384+
<Compile Include="System\Net\Http\CurlHandler\CurlHandler.SslProvider.OSX.cs" />
385385
</ItemGroup>
386386
<ItemGroup Condition="'$(TargetGroup)' == 'uap'">
387387
<Reference Include="Windows" />

src/System.Net.Http/src/System/Net/Http/Unix/CurlException.cs renamed to src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlException.cs

File renamed without changes.

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.ClientCertificateProvider.cs renamed to src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.ClientCertificateProvider.cs

File renamed without changes.

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.CurlResponseMessage.cs renamed to src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.CurlResponseMessage.cs

File renamed without changes.

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.EasyRequest.cs renamed to src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs

File renamed without changes.

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.MultiAgent.cs renamed to src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.MultiAgent.cs

File renamed without changes.

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.SslProvider.cs renamed to src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.Linux.cs

File renamed without changes.

0 commit comments

Comments
 (0)