Commit Graph
183 Commits
Author SHA1 Message Date
stephentoub 318936cdab Override ReadByte on SslStream
In an application that's using the Redis client library, a significant portion of the allocations are coming from calls to ReadByte on an SslStream.  Since SslStream doesn't override ReadByte, the base Stream.ReadByte is used, and it ends up allocating a temporary array to use in a call to Read.

This commit adds an override of ReadByte on SslStream that returns data from the stream's internal buffer if any is available, otherwise falling back to the old behavior.

On a test that repeatedly writes 1000 bytes and then reads each of those with ReadByte, allocations are reduced by 10x and throughput is doubled. (Note that removing the Interlocked.Exchange in ReadByte yields another 20% improvement in throughput, but I've left it in so as not to impact guarantees of the type.)


Commit migrated from https://github.com/dotnet/corefx/commit/b999431c9c519a797aff3eb472b614e0f15c6650
2016-02-04 08:25:22 -05:00
stephentoub 715cbde1c2 Update dependencies to rc3-23729
Commit migrated from https://github.com/dotnet/corefx/commit/372c940deee1f81c452e69a0ad46ae9f18f6d803
2016-01-29 18:11:41 -08:00
bartonjs 614c77f99b Make SslStreamPal.StartMutualAuthAsAnonymous a constant
Commit migrated from https://github.com/dotnet/corefx/commit/93ac19d8e584e17362bcc9614bb44814cd843295
2016-01-29 06:43:19 -08:00
Stephen Toub c82c776c03 Merge pull request dotnet/corefx#5758 from bartonjs/unix_sslstream_clientauth
Enable Client Auth Certs for Unix SslStream.

Commit migrated from https://github.com/dotnet/corefx/commit/f04c30f5ef95b5dd0f1ca5d5684b20c4cb0a2719
2016-01-28 23:23:19 -08:00
stephentoub de46cba923 Reenable cert validation test on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/c7f630678f752e96a95f8fc53c208306981eb7ea
2016-01-28 18:27:29 -08:00
Jose Perez Rodriguez 88f2de884f Merge pull request dotnet/corefx#5711 from joperezr/RestoreMSBuild
Use .Net Core MSBuild for OS X and Linux Builds

Commit migrated from https://github.com/dotnet/corefx/commit/ab6ec2fa803a330e73809cf478753959a36185e5
2016-01-28 15:51:39 -08:00
bartonjs a0da1541af Enable Client Auth Certs for Unix SslStream.
Pass the handle:

The Windows SslStream flow is to start a TLS session as server auth, then
process a CredentialsRequired during the handshake, add credentials to
the existing session, and continue.

It's hard to maintain symmetry on that flow for the Unix pathway, due to
the API differences in OpenSSL and SChannel.  So, the Unix session will
always pass down to native the provided client auth credentials, and
OpenSSL can use them when it sees appropriate.

Untrusted certificates should still complete handshake:

The Unix SslStream implementation had two different places that a client
authentication certificate was validated.  The first one was from an
OpenSSL callback, and reporting an error will interrupt the TLS handshake.
The second was from after the handshake, and presents the results to the
user validation callback to determine if data should be sent after the handshake.

In the ideal case the first version is redundant, in a user-handled case it caused
a failure when success was expected; so it should just be removed.

Enable the client authentication cert test for Unix:

Also asserts that the IsMutuallyAuthenticated property gets set, the certificates
used were the correct ones, and that both forward and callback versions of
providing the certificate function.


Commit migrated from https://github.com/dotnet/corefx/commit/908a129d5f32a6b5d2737d651445fdd38e1937ea
2016-01-28 15:36:59 -08:00
Jose Perez Rodriguez 0df7c31e39 Use .Net Core MSBuild for OS X and Linux Builds
Commit migrated from https://github.com/dotnet/corefx/commit/4367ec4c791928c6b2f994e9602dbc75aea7934d
2016-01-28 08:46:24 -08:00
Stephen Toub 75b957414f Merge pull request dotnet/corefx#5723 from stephentoub/update_license_headers
Update licensing headers

Commit migrated from https://github.com/dotnet/corefx/commit/ac67ffac987d0c27236c4a6cf1255c2bcbc7fe7d
2016-01-27 14:10:52 -08:00
stephentoub 9ecf277528 Update package versions to rc3-23727
Commit migrated from https://github.com/dotnet/corefx/commit/c442e611d1b4dddc12703b8b80bea9f3889f141d
2016-01-27 08:08:48 -08:00
dotnet-bot 39d1eab950 Update licensing headers
Commit migrated from https://github.com/dotnet/corefx/commit/7cad8486cbabbce0236bdf530e30db7036335524
2016-01-27 08:02:28 -08:00
Stephen Toub 8d935f132d Merge pull request dotnet/corefx#5717 from CIPop/removeCsProjTodo
Removing/updating TODOs from System.Net CSProj files

Commit migrated from https://github.com/dotnet/corefx/commit/7ed0277b10518c257a907815b08762a8f77fa43c
2016-01-26 21:59:57 -08:00
Lakshmi Priya Sekar 1aa7a9ac09 Update packages version to 23726.
Commit migrated from https://github.com/dotnet/corefx/commit/213da430524eceb9e90883c3d08848f62c813a91
2016-01-26 16:30:20 -08:00
Cristian Pop 643a78f92f Removing/updating TODOs from System.Net CSProj files
Commit migrated from https://github.com/dotnet/corefx/commit/2e7bd14c5e55ecda926977eef6d5717644783059
2016-01-26 16:15:32 -08:00
Stephen Toub d3bec923b6 Enable System.Net.Security tests on OS X
Commit migrated from https://github.com/dotnet/corefx/commit/b75bcefbae1f1a650224869773fb2bff650dbced
2016-01-25 22:37:01 -05:00
stephentoub 4ef1e70a8a Update package dependencies to rc3-23725
Commit migrated from https://github.com/dotnet/corefx/commit/fad28575225858febd3069d41582a1502c5dda07
2016-01-25 14:38:56 -05:00
Cristian Pop 6247a71128 Merge pull request dotnet/corefx#5642 from CIPop/snsasserts1
Fixing assert conditions for System.Net.Security.

Commit migrated from https://github.com/dotnet/corefx/commit/fab477215a4ce42f0364a4f67244333ef7483310
2016-01-25 10:40:01 -08:00
stephentoub 6545572fb1 Upgrade packages to rc3-23722
Commit migrated from https://github.com/dotnet/corefx/commit/02ece5061a33a7c12113cc4a52b2321d9e6db185
2016-01-23 11:36:29 -05:00
Cristian Pop 7b2e6bafc7 Fixing assert conditions for System.Net.Security.
Commit migrated from https://github.com/dotnet/corefx/commit/1baa844d3a12a5fc225e4c3408726ed917f3cb6e
2016-01-22 17:59:39 -08:00
Cristian Pop 2c567ee8a4 Merge pull request dotnet/corefx#5541 from CIPop/snsrw
Porting async implementation and adding TPL overrides for SslStream Read/WriteAsync

Commit migrated from https://github.com/dotnet/corefx/commit/fac18d8b452438f476b2976c2b7809b677521208
2016-01-22 10:35:12 -08:00
Cristian Pop 4762440ff6 Porting APM functionality for SslStream's InnerStream. Adding TPL wrappers and a simple test proposed by the community.
Commit migrated from https://github.com/dotnet/corefx/commit/aa2e8a7f31077d1787027cd851b88f6a29e126e5
2016-01-21 17:02:05 -08:00
stephentoub f9329ef695 Disable tests failing on CentOS or OpenSUSE
Commit migrated from https://github.com/dotnet/corefx/commit/24dba75503899e794ffde2cf07a4ada57f22072a
2016-01-21 18:29:05 -05:00
stephentoub 0fbf6b8716 Re-enable System.Net.Security tests on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/20199b506c8b1e624de69245ed9fa5b04628178e
2016-01-21 18:29:05 -05:00
stephentoub 891c3cd484 Fix clientCertificateRequired handling
The design of AuthenticateAsServerAsync has a clientCertificatesRequired flag.  On Unix we were mapping that to "SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT", which causes OpenSSL to fail the handshake if no cert is provided.  But the Windows code actually still allows this through, instead setting a policy error to indicate that no certificate was required.  I'm simply removing the SSL_VERIFY_FAIL_IF_NO_PEER_CERT flag to match that design.  I've also updated the test to assert that the error is actually being set.


Commit migrated from https://github.com/dotnet/corefx/commit/81f6c96f4f0562f1dfdf348f5ea9c126be28251e
2016-01-21 18:29:05 -05:00
stephentoub 607c97ab27 Update OpenSSL error handling
Fix handling of certain OpenSSL errors to ensure we don't confliate two different error schemes and don't lose error information in the interop code.


Commit migrated from https://github.com/dotnet/corefx/commit/b9d6a1a9a46bf4a74624a71cfe42b078c2f86dfc
2016-01-21 18:29:05 -05:00
stephentoub 6e02e979df Fix improper exception handling in ProcessAuthentication
The method sets a flag to indicate that an operation is in progress, then kicks off the operation, and then in a finally block potentially resets the flag.  The intent of resetting it is to reset the flag iff the operation is no longer in progress, which would be the case if the operation was synchronous or if the initiation of the asynchronous operation resulted in an exception.  As such, the finally block is checking whether the operation was synchronous or whether an exception has been captured.

However, for the exceptional case, this leads to race conditions.  The initiation of the asynchronous operaiton can lead to the operation running concurrently with the remainder of the ProcessAuthentication method, namely concurrently with the finally block.  If the operation starts quickly and fails quickly, it'll store the exception, which will cause the finally block to see that an exception has been captured and mistakenly believe that the operation failed synchronously, thus resetting the flag.  But the operation was actually asynchronous, and when EndAuthentication is called, it'll see that the flag has been reset and think that the EndAuthentication call is erroneous, thus throwing an exception.  While it should throw an exception (the one that caused the operation to fail), it ends up throwing an InvalidOperationException instead to signal that EndAuthentication was used incorrectly.

The fix is to move the check for the exceptional situation out of the finally and into a catch block.  The catch block is then used to reset the flag only if an exception emerges synchronously, and the finally block is used to reset the flag only for synchronous operations.  (It's possible that for synchronous operations that fail, the flag could be written as 0 twice... that's fine.)

This fixes the failure on both Windows and Unix.  The failure wasn't reproing on Windows but only because of differences in timing... adding a brief pause at the end of the try block would trigger the failure on Windows as well.


Commit migrated from https://github.com/dotnet/corefx/commit/9e63a418f6ab0dc01ab9e51f2ad9d498a35899cd
2016-01-21 18:27:22 -05:00
Eric StJohn ab95158a7e Merge pull request dotnet/corefx#5576 from ericstj/removeWindowsDependencies
Remove dependencies on WindowsIdentity from Unix binaries

Commit migrated from https://github.com/dotnet/corefx/commit/c8818d1907dc3c2313a18d92165c488dadfefa57
2016-01-21 11:59:15 -08:00
Eric Erhardt 4d42d8879e Bump ExpectedPrerelease version to latest (rc2-23713)
Commit migrated from https://github.com/dotnet/corefx/commit/ea4b19c136f3fa6355fd307b38cbe605b519b5eb
2016-01-21 09:46:18 -06:00
Eric St. John 23707936cb Remove dependencies on WindowsIdentity from Unix binaries
It looks like a couple libraries were using
System.Security.Principal.Windows unintentionally in their
Unix implementations.  @dagood discovered this when
trying to restore our tools-runtime project for unix RIDs.

This fix removes the dependencies from those libs
in the CoreFx repro.
/cc @CIPop @saurabh500

It looks like WCF also has this problem as well,
since it hasn't split System.Private.ServiceModel
into windows specific packages.
/cc @StephenBonikowsky


Commit migrated from https://github.com/dotnet/corefx/commit/6902316fed76f2a905ef626b7ef0a64b4749a237
2016-01-20 16:56:04 -08:00
Wes Haggard 389fa6745c Normalize .builds and .csproj file configurations
GenerateBuilds.ps1 generates the builds and default configurations
based on the configurations listed in the csproj. This commit is a
result of running the script to normalize and fixing any bad configurations.


Commit migrated from https://github.com/dotnet/corefx/commit/e7e275654026c2488f6a4116ff5f390e8ce015be
2016-01-18 00:42:32 -08:00
Stephen Toub 8b2dab2341 Merge pull request dotnet/corefx#5461 from CIPop/sn_disable_tests
Disabling System.Net intermittently failing tests

Commit migrated from https://github.com/dotnet/corefx/commit/cc5065b76ed50e10e24f5183db0d3e866f8a621d
2016-01-15 16:20:16 -05:00
Cristian Pop 4a4173d992 Disabling System.Net intermittently failing tests. Adding new tests for reported issues. Fixing test csproj file.
Commit migrated from https://github.com/dotnet/corefx/commit/be32a60de7e4eead5b7d3e045ea3ce4e1a34e855
2016-01-15 11:44:04 -08:00
stephentoub b349e58bc4 Add Debug.Fail calls at GlobalLog.Assert* call sites
Commit migrated from https://github.com/dotnet/corefx/commit/da4bf9a9a55b093614f645b2cd429146644f4d3c
2016-01-14 16:20:01 -05:00
stephentoub 2b6159d669 Replace globalLogEnabled caching with GlobalLog.IsEnabled
Per previous feedback.


Commit migrated from https://github.com/dotnet/corefx/commit/a2b956429fb10b771b2c9d5778b478d7e4b54904
2016-01-14 16:19:55 -05:00
Ian Hays e3311742d9 Bump ExpectedPrerelease version to latest (rc2-23712)
Commit migrated from https://github.com/dotnet/corefx/commit/01c61f62988e8abf39aecc64b0a97ea4e384de3f
2016-01-14 10:36:27 -08:00
Stephen Toub 2f43a6cb34 Merge pull request dotnet/corefx#5285 from stephentoub/more_net_logging
Mop up more System.Net logging guards

Commit migrated from https://github.com/dotnet/corefx/commit/4fc64ecb9046d15db4579a309bcef937f9ba889e
2016-01-13 21:08:15 -05:00
Stephen Toub ada5517874 Merge pull request dotnet/corefx#5388 from stephentoub/disable_net_test
Disable two more NegotiateStream tests

Commit migrated from https://github.com/dotnet/corefx/commit/700229d41764faa853679ef658636e01b59345e7
2016-01-13 18:38:29 -05:00
Stephen Toub 7e7598c93f Merge pull request dotnet/corefx#5350 from dagood/fix-project-dependencies-nugetexe
Fix project.json dependencies: xunit DNXCore incompatibility + invalid package dependencies

Commit migrated from https://github.com/dotnet/corefx/commit/d591a687578f01ead8421ee4898b7bf42e7d95d6
2016-01-13 16:06:59 -05:00
stephentoub eecb1c4983 Mop up more System.Net logging guards
Some more GlobalLog.IsEnabled guards. I noticed a few while doing some other profiling, and so did another set of searches across the whole codebase. Many of these came from the System.Net.Security PRs that were in-progress at the same time I was doing the previous logging changes.


Commit migrated from https://github.com/dotnet/corefx/commit/a04c9898b9bc6d06cd42e1dfd93a63633da4dd30
2016-01-13 16:01:18 -05:00
stephentoub 630172d362 Disable two more NegotiateStream tests
These have also been taking out multiple builds.


Commit migrated from https://github.com/dotnet/corefx/commit/0261628c6da0b09944e00b9ae82a064157188605
2016-01-13 15:34:05 -05:00
stephentoub 57fb36329d Disable failing NegotiateStream test
Commit migrated from https://github.com/dotnet/corefx/commit/6800636d5ff50601bc8fd84bab5c7fcc1d0ca379
2016-01-13 10:40:56 -05:00
dagood df455922aa Fix references to nonexistent packages by replacing with stable version where possible, otherwise the upgraded prerelease.
Commit migrated from https://github.com/dotnet/corefx/commit/063c9926f8b27cc987668deb4d75f18295506f17
2016-01-12 15:14:27 -06:00
dagood e401efd6af Add portable-net45+win8 import to tests.
Specifically, add the import to dnxcore50 frameworks entries where "xunit" is mentioned in the project.json.
This fixes `xunit.abstractions 2.0.0 is not compatible with DNXCore,Version=v5.0.`


Commit migrated from https://github.com/dotnet/corefx/commit/da2e8eb34efcaf70069223bc431d80909a2fc91d
2016-01-12 14:04:32 -06:00
Guillermo Rangel 54f514187f Deleting Logging.cs file
Substituting Logging calls to EventSource calls, or calls to
LoggingHash.

Formatting Changes

Fixing Aligment, and casing.

Changing Dump methods log the hash of the object calling it instead of the method

After some discussion, it was decided that it is more useful to log the
object where the dump happens, than the method. Doing the necessary
changes for it.

Changing usage of "this" to [CallerMemberName]

Instead of using this to know who called the logging method, using
[CallerMemberName] as an attribute to the parameter to fill that
information.

Adding a TODO item.

Making a note to not change NetEventSource or it can break.

Missing Underscore

Adding missing underscore in _wsaBuffer


Commit migrated from https://github.com/dotnet/corefx/commit/f39502ef910c90ba1e67d787df98b627d39ba6cc
2016-01-12 10:27:16 -08:00
Stephen Toub 1d5abed128 Merge pull request dotnet/corefx#5304 from stephentoub/switch_test_servers
Switch System.Net.Security test to use shared HttpTestServers

Commit migrated from https://github.com/dotnet/corefx/commit/4cdd4d9ab943546777dc67a0f30ed13d2eaa44bc
2016-01-11 13:50:28 -05:00
Stephen Toub b65f87769b Merge pull request dotnet/corefx#5301 from stephentoub/sockets_tests
Disable several System.Net tests that have been failing

Commit migrated from https://github.com/dotnet/corefx/commit/ac5dcc3ad4ebd93371ad82178cdccb55cc5eedff
2016-01-11 12:24:20 -05:00
stephentoub d66ba56618 Switch System.Net.Security test to use shared HttpTestServers
Commit migrated from https://github.com/dotnet/corefx/commit/d03c243c3676fc322f567e242ec47ee63ce096f6
2016-01-11 11:19:30 -05:00
stephentoub 6318ec9d57 Disable several System.Net tests that have been failing
Commit migrated from https://github.com/dotnet/corefx/commit/3456760d2e9fd755b4433b5516e656ce99607657
2016-01-11 09:08:31 -05:00
stephentoub 00e5ac2839 Fix URL used in System.Net.Security tests
An incorrect URL was causing the CertificateValidationRemoteServer_EndToEnd_Ok test to fail.


Commit migrated from https://github.com/dotnet/corefx/commit/3802cd82257433a3208f0ed20874e867af97a283
2016-01-11 09:07:04 -05:00
Cristian Pop 170be2da87 Merge pull request dotnet/corefx#5257 from stephentoub/socket_alloc
Remove ExecutionContext-related allocations from System.Net.Sockets

Commit migrated from https://github.com/dotnet/corefx/commit/17ddda61de3066c46107564435930a86daffcd61
2016-01-08 19:22:53 -08:00