Commit Graph
1131 Commits
Author SHA1 Message Date
Jeremy Barton cefe07725e Add initial support for TLS 1.3 to .NET Core
* TLS 1.3 connections have been tested on Ubuntu 18.10 (OpenSSL 1.1.1).
* There's no public version of Windows with TLS 1.3 enabled.
* There's no public version of macOS with TLS 1.3 enabled out of the box.

When making use of SslProtocols.None (system default) TLS 1.3 is already working on Ubuntu 18.10, this change mainly makes it so that EncryptionPolicy.None is better handled, and that we can restrict-to and report TLS 1.3.

Commit migrated from https://github.com/dotnet/corefx/commit/d30157d9e48cf73e267994e45953722d18ccd4c6
2018-11-12 17:49:05 -08:00
Max Kerr e742fd7a06 Fix Content-Type parsing of quoted charsets (dotnet/corefx#33280)
* Initial fix.

* Test improvements.

* Add comment explaining fix, revert testing change.

* Add new test validating the behavior for an invalid content-type header, add test case for empty string.

* Store headers.ContentType.CharSet to minimize repeated access.

* Clean up test to not rely on the loopback server.

* Switch test content to use characters outside of ASCII range. Disable test on netfx, since it doesn't have the fix implemented here.


Commit migrated from https://github.com/dotnet/corefx/commit/28e216680a990ce4a58798aa0d2026c9d3e1f148
2018-11-08 11:11:28 -08:00
Stephen Toub f42f25247a Fix Timer rooting issue with SocketsHttpHandler (dotnet/corefx#32793)
We have an unexpected rooted cycle that's unexpectedly keeping an HttpConnectionPoolManager and all of its state alive indefinitely if the HttpClient/SocketsHttpHandler isn't Disposed.

HttpConnectionPoolManager creates a "cleaning timer" that runs every now and then in order to remove stale connection pools that are no longer needed.  In order to do that, the Timer is passed the HttpConnectionManagerPool as state.  That normally wouldn't be a problem, except that the HttpConnectionManagerPool then stores a strong reference to the Timer, creating a cycle: Timer -> TimerHolder -> TimerQueueTimer -> HttpConnectionPoolManager -> Timer.  The TimerQueueTimer is rooted by the underlying timer implementation, with it stored in a static array.  And TimerHolder has a finalizer that disposes of the Timer, but it's being kept alive as part of the cycle.

To break the cycle, we give the Timer a weak reference (rather than strong reference) to the HttpConnectionPoolManager.

Commit migrated from https://github.com/dotnet/corefx/commit/449190d7c873b56337ba6a7f2d9b53f5232ad16d
2018-10-13 20:40:04 -04:00
Max Kerr 8e99673f97 Fix flaky 100-Continue test on CurlHandler. (dotnet/corefx#32653)
Commit migrated from https://github.com/dotnet/corefx/commit/5ee58d9cf528db08230edb201471da28cd7a5fe5
2018-10-05 17:40:00 -07:00
David Shulman e03c1b170b Skip some Http auth tests on UAP (dotnet/corefx#32646)
Some Http auth related tests have begun failing all the time on Outerloop UWP runs:

* GetAsync_ServerNeedsBasicAuthAndSetDefaultCredentials_StatusCodeUnauthorized
* GetAsync_CredentialIsNetworkCredentialUriRedirect_StatusCodeUnauthorized

The UAP version of Http stack uses WinRT APIs (which use WinInet). And there is
implicit caching of credentials per-process due to WinInet. So, we need to disable
these tests on UAP similar to other tests in this file.

Contributes to dotnet/corefx#32647

Commit migrated from https://github.com/dotnet/corefx/commit/e7e60c52911705bf38cd3dbbfbc9b726209130e7
2018-10-05 14:21:56 -07:00
Filip Navara ef59f0f707 Treat the 'algorithm' parameter in Digest HTTP authentication as case-insensitive. (dotnet/corefx#32632)
Fixes dotnet/corefx#32408


Commit migrated from https://github.com/dotnet/corefx/commit/1d737919b3a74dd3d26a80b2268014b48a41a8d4
2018-10-05 11:11:16 -07:00
Marco Rossignoli eed59da488 Fix HttpClient sending fragment portion of uri on request (dotnet/corefx#32574)
Fixes dotnet/corefx#32378


Commit migrated from https://github.com/dotnet/corefx/commit/87a944afb3e0ec392d5838900b5498e015d5e47b
2018-10-04 09:40:41 -07:00
Tomas Weinfurt 256e18fcd3 disable ConnectTimeout_TimesOutSSLAuth_Throws (dotnet/corefx#32564)
Commit migrated from https://github.com/dotnet/corefx/commit/b3475286fbfff67869f8fbc76f391c1f43a40f53
2018-10-01 13:38:57 -07:00
Tomas Weinfurt 6b900e8e6f socket handler does not depend on platfrom curl (dotnet/corefx#32543)
Commit migrated from https://github.com/dotnet/corefx/commit/20b2f55558f729f24fc063f520b35ab0adeec924
2018-09-29 14:28:39 -07:00
Jeremy Barton e54864fbc0 Check for the specific in-use version of OpenSSL when working with libcurl
Rather than check a generic 1.0/1.1, test for the specific library version that
the crypto shim has loaded.  This makes things work when both libcurl
and the crypto shim are using OpenSSL 1.1 and also prevents a state where two
different copies of the library (at different patch versions) are utilized.

Commit migrated from https://github.com/dotnet/corefx/commit/d33f8435461028ec131fcfd42232098aaf3e6ded
2018-09-26 15:35:35 -07:00
Santiago Fernandez Madero 5267216c37 Fix assert failing when getting network interfaces (dotnet/corefx#32394)
* Fix assert failing when getting network interfaces

* PR Feedback


Commit migrated from https://github.com/dotnet/corefx/commit/cae2180e1443e1ace51f7498e48fd84d95550358
2018-09-25 18:11:13 -04:00
Tomas Weinfurt 765e7510f9 skip content-length on DELETE and OPTIONS methods with no body (dotnet/corefx#32259)
* skip content-length on DELETE and OPTIONS methods

* breakup long line

* update after sync up

* fix spelling

* skip new test on winhttp

* disable test also on netfx and uap

* feedback from reviews

* use Assert.DoesNotContain for assert


Commit migrated from https://github.com/dotnet/corefx/commit/99211937b4f1735b7912f0a064b91ba60c8e9ca9
2018-09-16 19:53:34 -07:00
Geoff Kizer adff026bf7 Merge pull request dotnet/corefx#32211 from jbhensley/huffman-test
Added additional unit test scenario to Huffman encoding tests

Commit migrated from https://github.com/dotnet/corefx/commit/0a51fb5ff782f2f27ec4241feedfb90699de7361
2018-09-13 12:09:20 -07:00
jbhensley 0cd42d57af Fix whitespace
Commit migrated from https://github.com/dotnet/corefx/commit/a64edcab4735be20171206366ebeb878db0aac10
2018-09-12 13:05:08 -07:00
David Shulman 50526554e2 Disable nt auth tests on Nano (dotnet/corefx#32247)
The recent PR dotnet/corefx#32146 added these new tests.  But they fail on Nano SKU because HttpListener is not supported since http.sys is not present on Nano.

Commit migrated from https://github.com/dotnet/corefx/commit/9772bdfd5f61ab6587cdc93efc51f6e0101b24bc
2018-09-11 20:18:16 -07:00
Geoff Kizer 07f7385c42 HttpClient: add simple nt auth tests (dotnet/corefx#32212)
* add basic nt auth tests

* address review feedback and disable tests on non-Windows platforms


Commit migrated from https://github.com/dotnet/corefx/commit/860509c967c8566b36fc134b5ea001489e2289b3
2018-09-11 15:07:21 -07:00
jbhensley 4b015a412a Added test to emit EOS in the middle of an otherwise valid sequence.
Commit migrated from https://github.com/dotnet/corefx/commit/673c537c39f69df985e1f42a3861d57bd431764d
2018-09-10 17:21:11 -07:00
Geoff Kizer 48a62f1420 fix typos
Commit migrated from https://github.com/dotnet/corefx/commit/8e8a58be46c3c86452f5552ab861e59aef34db98
2018-09-06 16:37:24 -07:00
Geoff Kizer 14ae4f7b95 fix tests to use Span
Commit migrated from https://github.com/dotnet/corefx/commit/c77e291abc15e646d5223c4dc84f547f9858f923
2018-09-06 15:01:53 -07:00
Geoff Kizer 1140844668 fix Huffman decoding issue and add Huffman decoding tests
Commit migrated from https://github.com/dotnet/corefx/commit/e5388b2fd7f9ab29800426f843b0c026b49ba7e4
2018-09-06 14:30:04 -07:00
Max Kerr 35c26def3f Disable test that appears to be causing a hang in System.Net.Http tests. (dotnet/corefx#32048)
Commit migrated from https://github.com/dotnet/corefx/commit/01d396a97a5c07dd78c0da7fac80f6b4cf23cb40
2018-08-31 12:12:15 -07:00
Filip Navara 2a2c2ef521 Move uap, uapaot, netfx, netcoreapp and netcoreapp20 constant definitions to top-level build file. (dotnet/corefx#31470)
* Move uap, uapaot, netfx and netcoreapp constant definitions to top-level build file.

* Trying to fix compilation of PerformanceCounterLib for netcoreapp2.0 targets.

* Change netcoreapp definition to mean the current version only.

* Fix conflict in System.Private.DataContractSerialization.csproj.

* Revert change in src/shims/manual/Directory.Build.props.

* Fix condition in test.

* Bring back TargetsNetCoreApp, it was lost during rebases.

* Move definition of netstandard to top-level build file. Remove more netcoreapp/uap definitions from individual files.

* Fix vbproj compatibility.

* Address PR review and unify the definitions to use TargetGroup directly.

* Add back one "netstandard" definition.


Commit migrated from https://github.com/dotnet/corefx/commit/ac994544e749eac3e85b60bf0012ae2f85ae0e49
2018-08-29 08:49:33 -07:00
Viktor Hofer 70bffcd308 Enable netfx perf runs and promote to netstandard
Commit migrated from https://github.com/dotnet/corefx/commit/1b33f6c57bdcb4a2be715a8eaf7ec2483dc5c6c0
2018-08-23 19:55:26 +02:00
Max Kerr 967baf836d Implement HTTP/2 loopback server for frame level testing of SocketsHttpHandler (dotnet/corefx#31521)
This is an initial pass at support for frame level testing of the HTTP/2 protocol.

Commit migrated from https://github.com/dotnet/corefx/commit/66649ff5862c7b723fded40c505942de19bdb107
2018-08-06 14:39:12 -07:00
Caesar Chen cdc9c4261f Add HTTP/2 CookieContainer support (dotnet/corefx#31440)
* http/2 CookieContainer support

* address feedback

* address feedback 2

* remove grouping

* fix test issue


Commit migrated from https://github.com/dotnet/corefx/commit/f1be6ce925a2f3a97d8838674987f543058c0942
2018-08-06 12:44:42 -07:00
Dustin Masters 97531f9946 Fix looking up headers on HttpClient response (dotnet/corefx#31550)
Headers marked as `HttpHeaderType.Request` were not able to be accessed
via the `Headers.GetValues` method. When looking up a header,
the `HeaderDescriptor` gets set to to `HttpHeaderType.Custom` in
`GetHeaderDescriptor`, but the persisted header in `_headerStore` had
`HeaderType` set to `HttpHeaderType.Request`, so lookups would fail.
This change makes the insert logic consistent with the lookup logic.

Fixes dotnet/corefx#31143


Commit migrated from https://github.com/dotnet/corefx/commit/8917abaf35ea153f4bbf1098d74d02963ef08e76
2018-08-02 18:16:03 -07:00
David Shulman f10c0336a1 Add test helper to enable SocketsHttpHandler HTTP/2 testing (dotnet/corefx#31530)
The HTTP/2 feature is turned off by default on SocketsHttpHandler since the implementation
is not done. It can be enabled via AppContext or environment variable settings. However,
using those settings is not practical because we need a more granular way of turning on
the HTTP/2 feature for running certain tests.

This PR adds a test helper that uses reflection to set the internal _maxHttpVersion field
of SocketsHttpHandler. I also enabled one HTTP/2 test to demonstrate how to use this test
helper method.

Contributes to dotnet/corefx#31496

Commit migrated from https://github.com/dotnet/corefx/commit/2f9483cdf78c8b6319f471ccb09422a2b0248ee7
2018-08-01 11:49:23 -07:00
Dan Moseley 2b1fca45a1 Disable tests for UAP (dotnet/corefx#31466)
Commit migrated from https://github.com/dotnet/corefx/commit/622839530dec891f196b1b7f68aa45e35b435bf8
2018-07-30 09:05:01 -07:00
David Shulman da166250dc Fix networking tests to work against NETFX (dotnet/corefx#31397)
Several of these tests were disabled because they failed on NETFX. This PR adjusts the tests
to work properly on NETFX due to some differences in behavior from .NET Core.

Fixes dotnet/corefx#28882

Commit migrated from https://github.com/dotnet/corefx/commit/f5a165540c4067b8fe0635b9beb6102d0b1d87a3
2018-07-29 07:57:08 -07:00
Tomas Weinfurt 70298e83c9 add back parsing for simple configuration (dotnet/corefx#31314)
* add back simplified proxy configuration
* add tracing
* feedback from review


Commit migrated from https://github.com/dotnet/corefx/commit/2c5f29064929d4f1c60be7c5c301a488dfab02c4
2018-07-24 11:10:18 -07:00
Geoff Kizer 6a33b1c5d5 Merge pull request dotnet/corefx#31289 from geoffkizer/fixvpntestissue
fix a test issue caused by new MSIT VPN adapter

Commit migrated from https://github.com/dotnet/corefx/commit/9dd8bbc2f043813499e05783bde5ba1f08d0a868
2018-07-23 19:44:34 -07:00
Geoff Kizer 7670848c70 fix a test issue caused by new MSIT VPN adapter
Commit migrated from https://github.com/dotnet/corefx/commit/d730ec04c0ba9b96be1b88f282cd13635513a214
2018-07-23 15:29:31 -07:00
Tomas Weinfurt 4530e104dd improve port parsing to be more resilient against trailing characters (dotnet/corefx#31232)
improve port parsing to be more resilient against trailing characters


Commit migrated from https://github.com/dotnet/corefx/commit/56d177d8ed94096c13ac14894945899783b1a3df
2018-07-21 16:59:37 -07:00
Geoff Kizer cda93f3287 address review feedback
Commit migrated from https://github.com/dotnet/corefx/commit/04928d2ddedc8e9f62345b8725870f86a559e862
2018-07-17 11:52:36 -07:00
Geoff Kizer f7a4f23f7e rework request header framing and several other fixes
cleanup


Commit migrated from https://github.com/dotnet/corefx/commit/3134237aafbc598e69b23be29e3442ebe9795e70
2018-07-17 11:52:33 -07:00
David Shulman 94a3168144 Fix HttpWebRequest when using system proxy settings (dotnet/corefx#31100)
While investigating other HttpClient/HttpWebRequest proxy-related bugs, I discovered that
HttpWebRequest was not honoring system proxy settings as defined on Windows with IE
settings or on Linux using environment variables.

The problem is due to how HttpClient and HttpWebRequest differ in how they represent
the default behavior of using system proxy settings with the various properties. Fixed
HttpWebRequest so that it will translate the system proxy settings to the internal
HttpClient/HttpClientHandler objects.

I also removed an invalid Assert in HttpConnection. This assert was firing when using a proxy
that was defined on the loopback adapter using IPv6 literal "[::1]".  Due to issue dotnet/corefx#28863 with Uri,
the Uri.IdnHost property doesn't have the brackets for IPv6 literals. So, the Assert was
occuring.

I did not add any new CI tests because it is currently not possible to test system proxy settings
in CI since it involves changing machine configuration. But I ran manual tests.


Commit migrated from https://github.com/dotnet/corefx/commit/72119235e294e711871cf453f2ffc66ba17ff23b
2018-07-16 19:51:03 -07:00
David Shulman 26bfa7676c Disable PostRewindableStreamContentMultipleTimes test on NETFX (dotnet/corefx#31031)
PR dotnet/corefx#19082 changed .NET Core behavior to no longer dispose request content after send. However, the original behavior remains in .NET Framework. So, the test should be skipped on NETFX.

Closes dotnet/corefx#30987

Commit migrated from https://github.com/dotnet/corefx/commit/2a5e017d506fc7a2b5a8a7e03a0b87068d28033b
2018-07-12 12:45:39 -07:00
Santiago Fernandez Madero ccdea37829 Update netfx alias to target .NET 4.7.2 (dotnet/corefx#28883)
* Change netfx to target .NET 4.7.1

* Fix CoreFx.Private.TestUtilities to not reference System.Runtime.InteropServices.RuntimeInformation which is now inbox in netfx

* Fix StackTrace.Tests to be built against netstandard and run against netfx inbox

* Fix ValueTuple configurations to support net461 and add netfx placeholder configuration since in net471 it is now inbox

* Fix projects' package configurations that had netfx (net461) to still support net461 and netfx as a buildconfigurations

* Disable failing tests when running on .NET 4.7.1

* Make netfx target net472 and merge with master

* Update ActiveIssue comments to issue number only

* Workaround packages tests due to not installed targeting pack

* Match NSSupportPackage version to CLI's

* Remove netstandard support lib bin placing to runtime and testhost for netfx, fix reference paths to match new package

* Run UpdateVSConfigurations after merging conflicts with the newly updated SDK projects

* Add net461 package configuration to System.CodeDom

* Add net461 package configuration to System.Configuration.ConfigurationManager

* Add net461 package configuration to System.Security.Cryptography.Xml

* Add net461 package configuration to System.Security.Permissions

* Add net461 package configuration to System.ServiceModel.Syndication


Commit migrated from https://github.com/dotnet/corefx/commit/faad2e63b35bed10fe18195987a413308b97eded
2018-07-10 15:04:27 -07:00
Max Kerr 42e3d11321 Add support and tests for HTTP 308 Permanent Redirect (dotnet/corefx#30398)
This change adds support for 308 redirects to SocketsHttpHandler, and enables 308 redirects in our tests.

Fixes: dotnet/corefx#30389


Commit migrated from https://github.com/dotnet/corefx/commit/12e41edba6c9b177f21e30001ce3c890c5225132
2018-07-10 10:18:56 -07:00
Eric Erhardt 21b7a52139 Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/0343b37275d50fa44b8db91bd9ed8364f89600fc
2018-07-05 14:06:19 -05:00
Stephen Toub 9feab34ba2 Fix SocketAsyncEventArgs' handling of ExecutionContext (dotnet/corefx#30712)
SocketAsyncEventArgs has a few issues with ExecutionContext, presumably stemming from the fact that capturing ExecutionContext in .NET Framework is not a cheap operation.  As a result, when this code was written, it was optimized for avoiding calls to ExecutionContext.Capture.  The SAEA tries to hold onto a captured ExecutionContext for as long as possible, only re-capturing when either the SAEA is used with a different socket instance or when an event handler is changed.  That has several problems, though.  First, it largely violates the purpose of ExecutionContext, which is to flow information from the point where the async operation begins to the continuation/callback, but if the context is only being captured when the Socket or handler is changed, then the context isn't actually tied to the location where the async operation begins, and that means that data like that in an AsyncLocal doesn't properly flow across the async point.  Second, it means that the SocketAsyncEventArgs (the whole purpose of which is to cache it) can end up keeping state in an ExecutionContext alive well beyond when it should be kept alive, because the SocketAsyncEventArgs is holding onto the ExecutionContext instance until either the Socket or handler is changed.

This commit fixes this behavior.  Since ExecutionContext.Capture in .NET Core is relatively cheap (no allocation, primarily just a ThreadStatic access), we now just always capture the context when starting an operation, and then clear it out when completing the operation.

Commit migrated from https://github.com/dotnet/corefx/commit/851a53bee21639cd65e109b72fd5f9ef90cc0f39
2018-07-03 13:21:18 -04:00
Eric Erhardt 779486884e Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/ec546de620c5248f3662d6aaca989ed382b86b6b
2018-06-28 21:28:41 -05:00
Eric Erhardt 8b6d5baf20 Change .csproj to new Configurations property
Change .sln to use the managed C# project system GUID.


Commit migrated from https://github.com/dotnet/corefx/commit/e05508a62d28f4807f85abe9cb7adf8382f792b4
2018-06-28 17:49:22 -05:00
Stephen Toub 4c9eb2ec25 Simplify built-in types across corefx tests (dotnet/corefx#30660)
Commit migrated from https://github.com/dotnet/corefx/commit/7ae1a252d7e68c5513d2658de7a401c37e9b0504
2018-06-25 22:42:04 -07:00
Stephen Toub d8cf8e0a06 Fix CacheControlHeaderValue's rendering of negative values (dotnet/corefx#30554)
Yesterday I made an optimization in several places to avoid unnecessary Int32.ToString calls / string allocations.  Most of them were valid.  However, even though valid Cache-Control headers don't contain negative values and are properly caught by the parser parsing incoming headers, the setters on CacheControlHeaderValue allow negative values to be specified without validation.  If such negative values were used, my change made it so that in a culture where the current culture's NumberFormatInfo.NegativeSign is not "-", the wrong negative sign would be used when rendering.  This commit fixes that and adds a regression test.

Commit migrated from https://github.com/dotnet/corefx/commit/cea9971b75665f0c9d1c3f254c4fa8c58c7d494a
2018-06-20 12:51:11 -04:00
Eric Erhardt 96c6a1b8fa Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/0c7364e3a25b0d20dd5b4181fcb3041d949b92b9
2018-06-19 15:51:04 -05:00
David Shulman e813e968b6 Fix SocketsHttpHandler for Windows auth proxy CONNECT tunneling (dotnet/corefx#30478)
SocketsHttpHandler wasn't even trying to send Negotiate/NTLM auth tokens to a proxy. This was due
to some invalid logic regarding the "usingProxy" field in HttpConnection. Reworked this logic to
be clearer about the various kinds of proxy scenarios.

I refactored the loopback proxy server and made it much more robust. It can now handle multiple
requests and multiple connections which helps test against the other handlers whose behavior is
different in this area. I plan to do further work in consolidating the LoopbackServer and
LoopbackProxyServer classes in future PRs.

I created a separate HttpClientHandlerTest.Proxy.cs file and moved many existing proxy tests and
added new tests. The current HttpClientHandlerTest.cs file is still over 3000 lines and needs more
refactoring to make it easier to maintain and track test scenario coverage.

Fixes dotnet/corefx#30330


Commit migrated from https://github.com/dotnet/corefx/commit/ec1671fd7feffe1070a94d9d86379e0dd95ddcdf
2018-06-18 16:21:44 -07:00
Eric Erhardt 2053139c9a merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/1c91f96ec67a78a33268181d99a73a736b48c13e
2018-06-15 22:24:40 -05:00
David Shulman 11a5740636 Add HTTP/2.0 test server (dotnet/corefx#30309)
To prepare for the work of adding HTTP/2.0 support to SocketsHttpHandler, I deployed a new Azure
server. As with all HTTP/2.0 endpoints, only HTTPS (TLS) is supported.

This server is based on Azure Web Apps instead of Azure Cloud Services (classic). This makes it
easier to scale out and maintain as well as give us a staging environment to validate upgrades to
the test server without affecting the production PR/CI runs.

Although the default for HttpClient/HttpRequestMessage.Version is 2.0, only the older platform handler stacks (WinHttpHandler, CurlHandler, UAP) will send as HTTP/2.0. SocketsHttpHandler is currently just ignoring the version value and using HTTP/1.1 as the request version. When SocketsHttpHandler is modified to support HTTP/2.0, then all default requests by HttpClient will attempt HTTP/2.0. Our existing Azure test server (and loopback server) will still downgrade to HTTP/1.1. But this new test server will use HTTP/2.0.


Commit migrated from https://github.com/dotnet/corefx/commit/58892b9d2d95d6cc3f90811d75248f90e0ff716b
2018-06-12 06:58:04 -07:00
Stephen Toub 6cc996f95c Delete some unused .cs files (dotnet/corefx#30251)
In a few cases, this also highlighted other dead code that could be removed, e.g. a shim export we no longer need. And it highlighted some places where .cs files weren't included in a .csproj but should have been; I've fixed those.

Commit migrated from https://github.com/dotnet/corefx/commit/844415759d3f1525bf1f5d1bd79453c6aa8493f8
2018-06-12 09:46:47 -04:00