Commit Graph
19 Commits
Author SHA1 Message Date
Stephen Toub cb16c44b05 Expose ClientWebSocketOptions.RemoteCertificateValidationCallback (dotnet/corefx#28141)
* Expose ClientWebSocketOptions.RemoteCertificateValidationCallback

* Address PR feedback

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/c008bb5c791c930b1a5a8cb4bb160f6dc675240e
2018-03-19 19:12:32 -04:00
David Shulman 2969354735 Add tests for ClientWebSocket connections thru a proxy (dotnet/corefx#28031)
Created new tests for verifying ClientWebSocket connections
end-to-end thru a proxy.

Opened new issues dotnet/corefx#28024 and dotnet/corefx#28027 which cause the new tests to fail.

Fixes dotnet/corefx#26957

Commit migrated from https://github.com/dotnet/corefx/commit/02c3892380a392458a4d1f41c53ce2048cb6681d
2018-03-14 09:45:39 -07:00
Caesar Chen 9df60dc56a Make SocketsHttpHandler default Handler (dotnet/corefx#27821)
* set SocketsHttpHandler to default

* address feedback

* fix if check for 28002


Commit migrated from https://github.com/dotnet/corefx/commit/2b850f6fe5fd3171c2554da965cb07070e1d648e
2018-03-14 00:34:56 -04:00
Stephen Toub fd01dc8c39 Use shared SocketsHttpHandler for some ClientWebSocket options (dotnet/corefx#27994)
* Use shared SocketsHttpHandler for some ClientWebSocket options

Currently we're creating a new SocketsHttpHandler for each ClientWebSocket.  This change makes it so that if mostly default options are used (namely no credentials, no proxy, no cookies, and no client certificates), we'll use a shared handler instance.

* Make ClientWebSocketOptions.Proxy non-null by default

netfx's ClientWebSocketOptions.Proxy defaults to a system-default proxy.  It can then be set to null to mean "no proxy" or to another proxy.  This changes netcoreapp's Proxy to match as closely as possible.

It also then fixes up a few other settings on SocketsHttpHandler:
- UseDefaultCredentials wasn't being factored in.  On netfx, UseDefaultCredentials takes precedence over Credentials, so this does the same.
- UseCookies should be true iff Cookies is non-null.

Finally, removed Outerloop from some tests that did not need to be, as they didn't actually involve making external requests, and deleted some dead test code.


Commit migrated from https://github.com/dotnet/corefx/commit/d4853e2cfd69cda68c0b17fd54b6c7d2d48b7f98
2018-03-13 14:03:19 -04:00
Stephen Toub 62ff1478db Fix NullReferenceException when using client certs with ClientWebSocket (dotnet/corefx#27777)
Commit migrated from https://github.com/dotnet/corefx/commit/e9d0a64f1d275ef0cb41b3812d6226ac1a45cb49
2018-03-06 19:14:42 -05:00
Geoff Kizer b94eefba0f reorganize and cleanup some LoopbackServer code
Commit migrated from https://github.com/dotnet/corefx/commit/ec6a7215bb28a061d2357d8c3874447bc575132d
2018-02-13 15:43:59 -08:00
David Shulman 19ef688da1 Cleanup Windows 10 version detection (dotnet/corefx#25052)
* Cleanup Windows 10 version detection

Windows 10 Version 1709 ("Fall Creators Update") has been released. This
PR cleans up the version detection to use the latest RTM build numbers
and removes obsolete InsiderPreview detection for those tests.

Also, removed ActiveIssue for tests that are now fixed due to Windows 10
fixes.

Fixes dotnet/corefx#22187

* Addressed feedback


Commit migrated from https://github.com/dotnet/corefx/commit/ac410223aa763a0f67880815057ee1bfe0f4cb6e
2017-11-04 11:09:38 -07:00
Max Kerr fedc4ce05f Clean up code and comments.
Commit migrated from https://github.com/dotnet/corefx/commit/4f979dea6200600d753aebecb1af14a3f16d5d4e
2017-07-27 11:56:00 -07:00
Max Kerr 36ec932220 Reduce duplicate code and move unnecessary class level variables.
Commit migrated from https://github.com/dotnet/corefx/commit/577cf91b6c487cf8e44d26ee446b46c61add3e58
2017-07-27 09:10:21 -07:00
Max Kerr 348ea633a3 Separate the tests so as to leave the old tests unmodified for core.
Commit migrated from https://github.com/dotnet/corefx/commit/b4feb88b782d50b3d69a664a7b493041fe88f64a
2017-07-26 10:57:46 -07:00
Max Kerr ed865b3765 Modify WebSocket buffer size tests to correctly test minimum buffer sizes on .net framework.
Commit migrated from https://github.com/dotnet/corefx/commit/cbecf326d536ad376fce52bc8197fec8f7b3b643
2017-07-25 17:06:47 -07:00
Diego Perez Botero 969b8d695b ClientWebSocket supports client certificates in UWP (dotnet/corefx#21908)
With these changes, the UWP implementation of ClientWebSocket.ConnectAsync takes the ClientCertificates member of the app-provided ClientWebSocketOptions into account. The first client cert that can be successfully converted into a WinRT client cert (if any) is configured on the underlying WinRT MessageWebSocket instance, leading to the cert being used for mutual TLS authentication when establishing connections with WSS endpoints.

This fix leverages WinRT APIs that are only present since Windows 10 Insider Preview Build 16215, so API presence checks are in place.

Fixes dotnet/corefx#21393

Commit migrated from https://github.com/dotnet/corefx/commit/0c478304177f038af958959f1d106522b77bce26
2017-07-07 16:25:10 -07:00
Diego Perez Botero cabb68c754 Add ClientWebSocket client certificate test (dotnet/corefx#21466)
Adding new test case that pins the UWP shortcoming tracked by issue dotnet/corefx#21393. This test case requires special setup that is checked inside its ConditionalFact attribute.

I've confirmed that it consistently passes in .NET Framework test runs and
fails in UWP and .NET Core test runs (as expected). I'll enable it for UWP as part of the dotnet/corefx#21393 fix.

Contributes to dotnet/corefx#21393

Commit migrated from https://github.com/dotnet/corefx/commit/cb4cdee631fd1225cc511fee8db9c3d1491e237b
2017-06-26 10:40:52 -07:00
Caesar Chen 4b30b2094a make activeissue to numbers
Commit migrated from https://github.com/dotnet/corefx/commit/d621e61a47d2042815527852228651de8e74f852
2017-05-26 15:06:33 -07:00
Caesar Chen 2ab3855e08 fix some clientwebsocket issues
Commit migrated from https://github.com/dotnet/corefx/commit/e45088660010265c82decd4cf745b3a049bad464
2017-05-26 14:06:55 -07:00
Santiago Fernandez 96d1270381 Disable System.Net.* tests for issue dotnet/corefx#19967
Commit migrated from https://github.com/dotnet/corefx/commit/ec8df2b33e5a155325228fda75792c5319126f28
2017-05-22 16:32:50 -07:00
Daniel Harvey 252cdc5e95 Bulk updates of tests for AssertExtensions (dotnet/corefx#18491)
Bulk update to AssertExtensions.Throws for AOT support. This doesn't disable Assert.Throws.

Commit migrated from https://github.com/dotnet/corefx/commit/b43b4df2e0e2182154bb0f425cb4a61bc1269828
2017-04-18 09:52:02 -07:00
Stephen Toub a6b52b9d78 Fix new ClientWebSocketOptions tests on Windows 7
Commit migrated from https://github.com/dotnet/corefx/commit/ba447000fe97ec934e107e0c2a78b5f1d6ada4f2
2016-09-25 07:40:13 -07:00
Stephen Toub 7f7cd8a732 Add back missing WebSockets APIs
Adds to System.Net.WebSockets:
- WebSocketException deriving from Win32Exception
- WebSocketException.ctor()
- WebSocket.DefaultKeepAliveInterval
- WebSocket.CreateClientBuffer
- WebSocket.CreateClientWebSocket
- WebSocket.CreateServerBuffer
- WebSocket.IsApplicationTargeting45
- WebSocket.IsStateTerminal
- WebSocket.ReisterPrefixes
- WebSocket.ThrowOnInvalidState
- WebSocketContext.RequestUri
- WebSocketContext.Headers
- WebSocketContext.Origin
- WebSocketContext.SecWebSocketProtocols
- WebSocketContext.SecWebSocketKey
- WebSocketContext.CookieCollection
- WebsocketContext.User
- WebSocketContext.IsAuthenticated
- WebSocketContext.IsLocal
- WebSocketContext.IsSecureConnection
- WebSocketContext.WebSocket

(Several of these members just throw PlatformNotSupportedException. Others have a different implementation than on desktop but something that's reasonable for corefx given the rest of the implementation's differences, e.g. limits on buffer sizes.)

Adds to System.Net.WebSockets.Client:
- ClientWebSocketOptions.UseDefaultCredentials
- ClientWebSocketOptions.SetBuffer(int, int)
- ClientWebSocketOptions.SetBuffer(int, int, ArraySegment<byte>)

As part of this, I also:
- Updated ClientWebSocketOptions.KeepAliveInterval to default to 30 seconds, as it does on desktop, rather than defaulting to 0.
- Updated the managed websockets implementation to take the ClientWebSocketOptions buffer information into account, in particular the receive buffer size and the buffer itself (as long as offset and count don't represent a subset, which would have been a more intrusive change to support).


Commit migrated from https://github.com/dotnet/corefx/commit/c97a2c7ac8ff5a4473348adf2ba6ca6a141de116
2016-09-14 08:11:20 -04:00