Commit Graph
529 Commits
Author SHA1 Message Date
Stephen Toub 1457854fb7 Address PR feedback
- Have ClientWebSocket change the scheme from http{s} -> ws{s} instead of having HttpClient accept ws{s} urls.
- Use a duplex response stream only when the status code is 101
- Disable a test that relies on connection opening being cancelable


Commit migrated from https://github.com/dotnet/corefx/commit/518ea1c2f8ad882c9829c8c35d27d92063ac67f7
2017-09-28 21:08:28 -04:00
Stephen Toub 6dcb0c35a4 Use ManagedHandler in managed ClientWebSocket
ClientWebSocket's managed implementation currently has its own basic Socket-based code for establishing a websocket connection.  This change switches it to use ManagedHandler instead, and in doing so benefits from improvements made to ManagedHandler thus far and in the future.  For example, currently ManagedWebSocket doesn't support ClientWebSocketOptions.Proxy or ClientWebSocketOptions.Credentials, but since ManagedHandler does, now ManagedWebSocket does, too.


Commit migrated from https://github.com/dotnet/corefx/commit/db9f342cc43e0096b42d4d6d008c095da2bb8cfa
2017-09-28 21:08:28 -04:00
Stephen Toub f18c6b1018 Make several allocations from ClientWebSocketOptions lazy
Commit migrated from https://github.com/dotnet/corefx/commit/87ae016da78b9a29be33cc17f076b32c57c2a699
2017-09-28 21:08:27 -04:00
Stephen Toub 6ca3d41d49 Fix several Connect test's dependence on ReceiveAsync returning complete message
There's no guarantee that WebSocket.ReceiveAsync will return a complete message; in the extreme, a message can contain long.MaxValue bytes but the API only allows you to retrieve ~int.MaxValue at a time, but even way below that, it's common for ReceiveAsync to return the data it has available rather than gathering up all of the data from the message.  However, several of the ConnectTest tests were depending on the full-message behavior.  This commit fixes that.


Commit migrated from https://github.com/dotnet/corefx/commit/ffaf5375c00622b285997bc9626c042b9d64195c
2017-09-28 21:08:26 -04:00
Stephen Toub 0b0e20a963 Reduce running time of KeepAlive_LongDelayBetweenSendReceives_Succeeds test
60 seconds is annoyingly long when trying to iterate.  Reduced to 10.


Commit migrated from https://github.com/dotnet/corefx/commit/941c4c80f0d25b34808d19adc7f8556107a88718
2017-09-28 21:08:23 -04:00
Andrius Bentkus d443114434 Do not use zero width spaces (dotnet/corefx#24069)
Fixes dotnet/corefx#24068

Commit migrated from https://github.com/dotnet/corefx/commit/13db0aefa78577e9c9fd5574103178383c16508e
2017-09-15 07:14:33 -07:00
David Shulman 852d0050d8 Disable brittle WebSockets.Client test (dotnet/corefx#23920)
System.Net.WebSockets.Client.Tests.KeepAliveTest/KeepAlive_LongDelayBetweenSendReceives_Succeeds

"System.Net.WebSockets.WebSocketException : The WebSocket is in an
invalid state ('Aborted') for this operation. Valid states are: 'Open,
CloseReceived, CloseSent, Closed'"

dotnet/corefx#23204

Commit migrated from https://github.com/dotnet/corefx/commit/d075c7d1ca07657a3c4f71a94dd944d9ab28d31a
2017-09-09 18:38:32 -07:00
David Shulman c3dbc2406e Disable some networking tests
Disabling tests.
dotnet/corefx#23765 dotnet/corefx#23766 dotnet/corefx#23767 dotnet/corefx#23768 dotnet/corefx#23769 dotnet/corefx#23770 dotnet/corefx#23771


Commit migrated from https://github.com/dotnet/corefx/commit/acafae51592f7e09fba003a3684d550dba155a2e
2017-09-02 16:50:54 -07:00
Brian Chavez 88875187b0 XML doc spelling corrections - D through H. 🚿 (dotnet/corefx#23638)
Commit migrated from https://github.com/dotnet/corefx/commit/a27929935d2782cdc3e7be21653e8c4530274c6f
2017-08-29 17:10:01 -07:00
Tarek Mahmoud Sayed 3765a6069b Moving PlatformDetection to Corefx.Private.TestUtilities assembly (dotnet/corefx#23109)
* Moving PlatformDetection to Corefx.Private.TestUtilities assembly

The purpose of this change is to clean up all test projects instead of including the PlatformDetection code inside every test project, we’ll have it in the Corefx.Private.TestUtilities.
I have refactored the PlatformDetection to split the different implementation of Windows and Linux. If we need to do more refactoring there we can do it later as needed.

* Fix Linux BB

* Update the xunit package reference

* Fix wrong condition on one of the tests

* Update the ConditionalFact/Theory to use Type as a parameter


Commit migrated from https://github.com/dotnet/corefx/commit/878e2fcf5a9f1068015e5fada9231088663e3490
2017-08-10 22:37:36 -07:00
Max Kerr ffd6207be0 Add test for WSS handshake secure cookies, modify cookiecontainer behavior to reflect that WSS is a secure protocol.
Commit migrated from https://github.com/dotnet/corefx/commit/cbf4667bd1eafec3dcff5124c736b26696ad068c
2017-08-07 09:23:41 -07:00
Cristian Pop c01a3bc145 Fixing abort race condition in ClientWebSocket for UWP. (dotnet/corefx#22896)
Commit migrated from https://github.com/dotnet/corefx/commit/433606d4763b0a3260c7fb669d28a10babf9a7f1
2017-08-03 12:05:21 -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
Caesar Chen 26ba210377 Merge pull request dotnet/corefx#22189 from caesar1995/array_hl
Add PlatformDetection.PartialMessagesSupported and disable Arrays with non-zero lower bounds on not supported platform

Commit migrated from https://github.com/dotnet/corefx/commit/2563bd0ec0cde39b43857b86109e86f6302bc02e
2017-07-14 10:50:36 -07:00
Caesar Chen 1c426afb11 check property if need to cache result, and remove active label for a fixed issue
Commit migrated from https://github.com/dotnet/corefx/commit/76143cecee7a75a503e21dbc6107f8ef8955ad8b
2017-07-13 15:31:11 -07:00
Caesar Chen c8a9710aee address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/227124eb77086a3310960d031be85801f7b69f24
2017-07-12 22:03:44 -07:00
Diego Perez Botero 4219957f83 Pinning correct WebSocketState.Closed behavior (dotnet/corefx#22183)
As part of the dotnet/corefx#20362 investigation, it has been determined that the non-UWP .NET Core behavior around WebSocketState.Closed is incorrect. These changes pin the correct (.NET Framework) behavior.

After these changes, there will be no remaining UAP-specific ActiveIssue or SkipOn* annotations in the entire System.Net.WebSockets* namespace.

Contributes to dotnet/corefx#20362 dotnet/corefx#20132

Commit migrated from https://github.com/dotnet/corefx/commit/eb4ae1051d227a7d468cb1aa224c1d7057874502
2017-07-12 18:06:01 -07:00
Caesar Chen 9e551b56d0 fix dotnet/corefx#22164
Commit migrated from https://github.com/dotnet/corefx/commit/331a586374e51ee6fa52439d9a0a34bbc3dcd8fa
2017-07-12 15:32:30 -07:00
Diego Perez Botero 6fa459a9cf Re-enabling ClientWebSocket close and cancel tests in UWP (dotnet/corefx#22072)
Re-enabling ClientWebSocket's CloseTest and CancelTest runs for UWP.

All of these tests pass after a minor behavioral fix, where the "cancel pending ReceiveAsync" scenario was resulting in a different exception type compared to .NET Framework and non-UWP .NET Core. The following CancelTest test cases caught the bad behavior that I'm fixing as part of this PR:

ReceiveAsync_CancelThenReceive_ThrowsOperationCanceledException
ReceiveAsync_ReceiveThenCancel_ThrowsOperationCanceledException
ReceiveAsync_AfterCancellationDoReceiveAsync_ThrowsWebSocketException

Contributes to dotnet/corefx#20132

Commit migrated from https://github.com/dotnet/corefx/commit/218348948f536a89f71a61f279d50353f587eb0d
2017-07-12 14:00:08 -07:00
Diego Perez Botero 6fbf27b030 Re-enabling ClientWebSocketUnitTest runs in UWP (dotnet/corefx#22127)
Contributes to dotnet/corefx#20132

Commit migrated from https://github.com/dotnet/corefx/commit/1ba2ac2b09d7ddf4513d090c18c7dd4ab9700550
2017-07-11 18:48:10 -07:00
David Shulman 823f81b56e Implement client certificates for HttpClient on UAP (dotnet/corefx#22022)
* Implement client certificates for HttpClient on UAP

Added code for HttpClientHandler.ClientCertificates on UAP.

Moved code duplicated in several places into a common helper class, CertificateHelper.
Then I discovered a bug introduced into GetEligibleCertificates (from PR dotnet/corefx#21908) that
doesn't properly filter by EKU or KeyUsage if there is only one cert (this was failing
the WinHttpHandler Unit tests). So, I removed that optimization.

Used the new Azure test endpoint for client certificates. I did not use the loopback
server because there is a problem using it with HttpClient in UAP. There is a crash
in the SslStream.AuthenticateAsServer that I was not able to diagnose yet. It will
require a lot of time debugging and I wanted to get this HttpClientHandler feature
done now. Tracking that investigation with dotnet/corefx#22021.

Fixes dotnet/corefx#21628
Contributes to dotnet/corefx#14542

* Address PR feedback

* Moved method to Windows-only Common file
* Fixed some line spacing

Other potential refactoring/optimizations will be looked into in dotnet/corefx#22045


Commit migrated from https://github.com/dotnet/corefx/commit/472b8d8ec212c2afb107dea305b4624c4989a79f
2017-07-10 16:52:07 -07:00
Diego Perez Botero f51efcb970 UWP ClientWebSocket.ReceiveAsync returns partial message data as it arrives (dotnet/corefx#21755)
With these changes, the UWP implementation of ClientWebSocket.ReceiveAsync hands partial WebSocket message data back to the app as soon as it arrives. This eliminates the behavioral difference between .NET Core and UWP tracked by issue dotnet/corefx#21102.

This fix leverages WinRT APIs that are only present since Windows 10 Insider Preview Build 16215, so API presence checks are in place. The pre-fix behavior takes effect when running on older Windows builds.

Fixes dotnet/corefx#21102

Commit migrated from https://github.com/dotnet/corefx/commit/09d029cbe1734ffb4f2ee5f259acfd69ea172158
2017-07-07 18:27:58 -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
Hugh Bellamy 98b18432b7 Move AssertExtensions to Corefx.Private.TestUtilities (dotnet/corefx#21799)
* Move AssertExtensions to Corefx.Private.TestUtilities

* Update csprojs

* Fix Linq.Expressions uapaot build


Commit migrated from https://github.com/dotnet/corefx/commit/7e3b0db2892c56a431f8e99af9cd9381adec385a
2017-07-03 09:27:30 -07:00
Stephen Toub 14d677349a Move ManagedWebSocket from System.Net.WebSockets.Client to System.Net.WebSockets (dotnet/corefx#21713)
Commit migrated from https://github.com/dotnet/corefx/commit/04a4db80a0d1a0d730a6041d2671572c4009a705
2017-06-29 20:42:39 -04:00
Cristian Pop 23a2417388 Tracking ETW UAP test failures against a single issue. Global mutex is not supported in UAP. (dotnet/corefx#21732)
* Removing Global mutex bug ID. Tracking ETW UAP test failures against a single issue.
* Disabling EKU tests for UAP.

Commit migrated from https://github.com/dotnet/corefx/commit/12632fd50d02c1b1934cac13edc8225304ac91a5
2017-06-29 16:22:14 -07:00
Diego Perez Botero 7cab575fa0 Fix unhandled exception when UWP ClientWebSocket loses connection to server (dotnet/corefx#21600)
The UWP implementation of ClientWebSocket uses WinRT MessageWebSocket APIs internally. If a connection-related or message-processing failure occurs, WinRT raises a MessageReceived event that throws an exception containing the failure's details when GetDataReader() is called. Unfortunately, ClientWebSocket isn't handling those exceptions inside its MessageReceived event handler, so they end up bringing down the entire process.

These changes add basic handling of GetDataReader() exceptions. They also contain a new functional test that pins the current behavior of all ClientWebSocket implementations around the "connection is prematurely closed" scenario. Without the proposed product code changes, this new test case reproduces the crash tracked by dotnet/corefx#17317.

Fixes dotnet/corefx#17317

Commit migrated from https://github.com/dotnet/corefx/commit/5573a9e3d4151642e8e2ff477eba2f2eda954fb4
2017-06-28 11:47:27 -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
Hugh Bellamy 7cbcd5ed85 Convert most Assert.Throws<ArgumentException> without param name to AssertExtensions (dotnet/corefx#21455)
* Registry

* Collections

* ComponentModel

* Configuration

* Data

* Globalization

* Drawing

* Diagnostics

* IO

* Linq

* Add System.Net param names in tests

* Move ArgumentExceptions in System.Private.Xml to AssertExtensions

* Add System.Reflection.* ArgumentException param names

* Add param names for System.Runtime* ArgumentExceptions

* Add ArgumentException param names to System.Security.*

* Add ArgumentException param names to System.Text.*

* Add param names to ArgumentExceptions in misc projects

* Add System.Threading.* ArgumentException param names

* Fix missing files

* Fixes for unix and netfx

* Fix more failures and revert a IdnaConformance tests to avoid merge conflicts with dotnet/corefx#21463


Commit migrated from https://github.com/dotnet/corefx/commit/59915687bb261efeae70565d0ca8990ac45ceb9c
2017-06-23 12:33:47 -07:00
Diego Perez Botero 581c27b0dd Add ClientWebSocket partial message test (dotnet/corefx#21138)
Adding new test case that pins the ClientWebSocket.ReceiveAsync
behavioral difference between .NET Core and UWP tracked by issue dotnet/corefx#21102.
I've confirmed that it consistently passes in non-UAP test runs and
fails in UAP test runs. Disabling it for UAP for now; will enable it as part of the dotnet/corefx#21102 fix.

Commit migrated from https://github.com/dotnet/corefx/commit/6f095617caaf308292af1e792d94bd0548e19769
2017-06-20 15:28:38 -07:00
David Shulman 61f6e49359 Disable some WebSockets Client tests for UAP/ILC test runs
Disable some WebSockets.Client tests on 'uap' and 'uap-aot' test runs

Contributes to dotnet/corefx#20132.


Commit migrated from https://github.com/dotnet/corefx/commit/80901aa5440c439f9b6652cd6a9fc55ac5c2fbec
2017-05-31 14:04:54 -07:00
David Shulman 59215e6e4b Merge pull request dotnet/corefx#20376 from schen381/bugfix_19967
Fix some System.Net.WebSockets.Client.Tests failures

Commit migrated from https://github.com/dotnet/corefx/commit/c27ba0fbd351fe5ba93c9079867e9faeea2a3887
2017-05-30 12:31:35 -07:00
Caesar Chen c4eb7a86c1 address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/95f6760f030928eee6d42654518635a95bdca0db
2017-05-30 09:15:34 -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 10001982c3 revert back a test
Commit migrated from https://github.com/dotnet/corefx/commit/9a55582f55701a1d958afbebaa5d77b089295341
2017-05-26 14:58:43 -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
Eric St. John af1d155bf6 Remove help VS comments
Many CSProjs included the comment
`<!-- Help VS understand available configurations -->`

These aren't handled well by the tooling that rewrites projects and weren't providing much value.

Remove them.


Commit migrated from https://github.com/dotnet/corefx/commit/5ba948d13e3177c2c7075b6b00791e574bfa0860
2017-05-25 11:10:27 -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
Eric St. John e02c675179 Increment versions post 2.0
Commit migrated from https://github.com/dotnet/corefx/commit/6c5f87319a4785499008c95b2ff5e7f13a413d22
2017-05-16 14:12:16 -07:00
Lakshmi Priya Sekar d13b95a549 Fixing OID EKU validation.
Commit migrated from https://github.com/dotnet/corefx/commit/023ecc91671ea48a0e27d466d13003d4830d671a
2017-05-10 13:29:13 -07:00
Stephen Toub 85f212528e Add exception diagnostics to WinHttp
To help diagnose pernicious exceptions, this debug-build-only change augments exceptions created using CreateExceptionUsingError to include the calling thread's stack trace, so that when these exceptions are then moved to other threads and propagated there, we can better correlate where they came from.


Commit migrated from https://github.com/dotnet/corefx/commit/2c368e81d9d07f0d40edf36047e5b93e44db200b
2017-05-05 18:16:38 -04: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
Wes Haggard 4185183e8c Updates how we define which key an assembly uses
Now instead of Use*Key a project can instead define the assembly key
in the project (genreally the common dir.pops for a project) using
the AssemblyKey property. The accepted values are Open, ECMA, MSFT,
Test.

This change allows for a repo to set the default key they want to use
for projects. In corefx we have switched the default to use the Open
key instead of the old BuildTools default of MSFT key.

As part of this update we are explicitly setting the AssemblyKey in
all the library projects (although it is really only necessary for
projects that aren't the default).

Also with this change we are updating all the new libraries that have
not yet shipped stable (compared to our 1.1 release) and making them
use the Open key. Which means that for prerelease dependencies there
might be some binary breaking changes to consume.

The following libraries ahven't shipped so there key is being
changed from MSFT to Open:
Microsoft.XmlSerializer.Generator
System.CodeDom
System.Configuration.ConfigurationManager
System.Data.Odbc
System.DirectoryServices
System.DirectoryServices.AccountManagement
System.DirectoryServices.Protocols
System.IO.Ports
System.Json
System.Memory
System.Net.HttpListener
System.Net.Mail
System.Net.ServicePoint
System.Net.WebClient
System.Net.WebProxy
System.Private.Xml
System.Private.Xml.Linq
System.Security.Cryptography.Xml
System.Security.Permissions
System.Transactions.Local
System.Web.HttpUtility


Commit migrated from https://github.com/dotnet/corefx/commit/ac09a797d09502ebab61f7167bb856846602e1e6
2017-04-10 12:51:50 -07:00
Stephen Toub 6a3b7f54a0 Merge pull request dotnet/corefx#17653 from steveharter/FixWebSocketDispose
Avoid NullReferenceException in WinHttpWebSocketState.Dispose

Commit migrated from https://github.com/dotnet/corefx/commit/cac3d484fa3c39479f27bea02105457fa72acf8c
2017-03-29 14:04:34 -04:00
Steve Harter 56fc34652d Avoid NullReferenceException in WinHttpWebSocketState.Dispose
Commit migrated from https://github.com/dotnet/corefx/commit/d7a4b2fe6f7c0609c540392e13a0eb44ba31cebb
2017-03-29 10:34:18 -05:00
Caesar Chen ad22b46094 Change the behavior of ReceiveAsync cancellation to throw OperationCanceledException (dotnet/corefx#17444)
* fix the behavior of ReceiveAsync cancellation throws WebSocketException


Commit migrated from https://github.com/dotnet/corefx/commit/d6b11250b5113664dd3701c25bdf9addfacae9cc
2017-03-25 10:54:45 -04:00
David Shulman 5f80e91b11 Skip more NetEventSource logging tests on .NET Framework
Similar to PR dotnet/corefx#17348.

The 'NetEventSource' logging only works on .NET Core libraries. So, we
need to skip these tests when running on full .NET Framework.


Commit migrated from https://github.com/dotnet/corefx/commit/f3ef848efda44caa99b2586591e6bd90856b5a57
2017-03-21 14:00:19 -07:00