Commit Graph
1293 Commits
Author SHA1 Message Date
Lakshmi Priya Sekar 47fa09f560 Include userhash key when username hashed.
Commit migrated from https://github.com/dotnet/corefx/commit/78487b856b9646fe4e8de81ece0f3ca893ef07ac
2017-08-03 12:51:43 -07:00
Lakshmi Priya Sekar d14642f5f6 No quotes for username*
Commit migrated from https://github.com/dotnet/corefx/commit/08b6d9e767f7417084781d2373fe5856dc59ae00
2017-08-03 12:51:43 -07:00
Lakshmi Priya Sekar 73a4898956 Respond to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/41cd8462457a04c6cf6a38a17a74ce06b838a673
2017-08-03 12:51:42 -07:00
Lakshmi Priya Sekar 34f5e20533 Use username* for usernames with reserved chars.
Commit migrated from https://github.com/dotnet/corefx/commit/db393a7835c76486a6a5a9f8eb1d81820c261ca7
2017-08-03 12:51:42 -07:00
Lakshmi Priya Sekar ee12332f74 Support digest auth for Proxy authentication in managedhandler.
Commit migrated from https://github.com/dotnet/corefx/commit/a1e8bc37d3c071b59d1bf7406e23b077fe2b693b
2017-08-03 12:46:30 -07:00
Stephen Toub 7e8d887b2f Fix ManagedHandler environment proxy setting handling (dotnet/corefx#22898)
Missing a clause resulting in test failures.

Commit migrated from https://github.com/dotnet/corefx/commit/c7d8cbfd921b3153b301cca777056b361783a3d2
2017-08-03 07:53:29 -04:00
Stephen Toub b8b0144608 Clean up usage of UriHelper (dotnet/corefx#22888)
* Delete dead UriHelper from System.Net.Http

* Replace UriHelper usage with Uri usage

Also clean up IsHexDigit/FromHex to be more streamlined.


Commit migrated from https://github.com/dotnet/corefx/commit/8b4fd5fccf19c2e342ddc3eb25f62507f300c778
2017-08-02 20:21:57 -04:00
Stephen Toub 2177f832b6 Remove UriShim from HttpClient (dotnet/corefx#22873)
- Uri's members are now back in core; it can just use those directly.
- Rather than calling HexEscape per character, which allocates a string per character, we can just encode directly to the StringBuilder.

Commit migrated from https://github.com/dotnet/corefx/commit/172f077c7875f12aa170a68f7ca62655e298badf
2017-08-02 16:44:02 -04:00
Stephen Toub c4562d3b87 Add basic EventSource tracing to ManagedHandler (dotnet/corefx#22867)
* Add basic EventSource tracing to ManagedHandler

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/2c986e4f1658708242b2fe0d39bf8cbff88f0eaa
2017-08-02 16:43:27 -04:00
Cristian Pop 88d0c2191b Enabling HttpClient EKU tests. (dotnet/corefx#22737)
Commit migrated from https://github.com/dotnet/corefx/commit/339f2223df42e4b7604b990ab1ce1b25c49bb662
2017-07-28 19:50:39 -07:00
Lakshmi Priya Sekar 0974a2809e Merge pull request dotnet/corefx#22676 from Priya91/digest
Implement digest authentication for ManagedHandler.

Commit migrated from https://github.com/dotnet/corefx/commit/0485dc0aa5248d23878c08c710f0852115a72ab0
2017-07-28 17:40:58 -07:00
David Shulman bf75c2d777 Fix HttpClient redirection logic on UAP (dotnet/corefx#22702)
* Fix HttpClient redirection logic on UAP

This PR changes the implementation of sending requests in HttpClient for UAP when
dealing with redirection. In the past, we would let the WinRT layer handle auto
redirection logic. However, due to dotnet/corefx#9003, the cookies were getting lost on 3xx responses
since the .NET layer didn't see them. So, this PR implements the redirection ourselves.

One important part of redirection is that we need to drop credentials. The WinRT layer
did this for us. However, we are unable to use a single WinRT HttpBaseProtocolFilter object
since we need to remove the credential after the first redirect. So, we need to maintain
a second filter that uses no credentials and keep it in sync regarding all the other properties
of the primary filter.

With this PR, the behavior of other aspects (such as controlling max number of redirects, etc.)
now matches .NET Framework.  So, some tests were adjusted to remove the UAP specific behavior
checks.

Fixes dotnet/corefx#9003
Fixes dotnet/corefx#22191

* Disable test on Linux

* Address PR feedback

* Disable failing HTTP/2 test


Commit migrated from https://github.com/dotnet/corefx/commit/f2308f8db0679ac63e8e7eeac9d56cb035d6d9e3
2017-07-28 16:43:40 -07:00
Lakshmi Priya Sekar d473352c04 Check for mandatory values from challenge, return null if not present.
Commit migrated from https://github.com/dotnet/corefx/commit/3f01ae65c39c5fbf66963198f9d6d2dfff948f9d
2017-07-28 15:18:57 -07:00
Lakshmi Priya Sekar efa8136cf3 Add retry option for digest auth in case of server nonce timeout.
Commit migrated from https://github.com/dotnet/corefx/commit/13fc5afad0127d69717973842f49f5cc6df65c75
2017-07-28 15:18:56 -07:00
Lakshmi Priya Sekar 2b7923495a Respond to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/0c910ac2778eb4dc9ae175cda539c6704011927a
2017-07-27 18:34:15 -07:00
Lakshmi Priya Sekar f4ff56e98b Implement digest authentication for ManagedHandler.
Commit migrated from https://github.com/dotnet/corefx/commit/75fbb6235a08fc3f24ce123204b217d7088630f3
2017-07-26 21:09:28 -07:00
Stephen Toub a460718ac5 Fix several test failures
Commit migrated from https://github.com/dotnet/corefx/commit/d659a500dd349eb570e074b95de265b9254dda7e
2017-07-25 16:21:00 -04:00
Stephen Toub 09a164fc78 Avoid compiler issues with Span being lifted to a state machine
Commit migrated from https://github.com/dotnet/corefx/commit/6af9d4ebf22fb5846971174b3b045b6efd2406b4
2017-07-25 12:34:22 -04:00
Stephen Toub 1619be0b81 Remove several fields from async state machines
Commit migrated from https://github.com/dotnet/corefx/commit/310498943b3602a1656528ac88ffa800b30f13fe
2017-07-25 12:34:22 -04:00
Stephen Toub 9de3bc4b5e Several more tweaks
- Use Span instead of ArraySegment where possible
- Consolidate throws into a helper that uses a resource string
- Improve reading of CrLf
- Improve writing of end of chunks


Commit migrated from https://github.com/dotnet/corefx/commit/e09f35cb49f03ce79ee163df5e1008f68689d25e
2017-07-25 12:34:22 -04:00
Stephen Toub 0b5f831169 Separate classes into their own files
Commit migrated from https://github.com/dotnet/corefx/commit/2ede81f8bbb7005d3895be224bd8b861cccae8c2
2017-07-25 12:34:22 -04:00
Stephen Toub 78d5a48cde Employ single empty response stream
Commit migrated from https://github.com/dotnet/corefx/commit/79804fa238eb57648f616f1a0577164f66f5bccc
2017-07-25 12:34:21 -04:00
Stephen Toub 034c3ab9a0 Read header lines asynchronously line-by-line rather than byte-by-byte
Commit migrated from https://github.com/dotnet/corefx/commit/398a1bc8bc9d3207af5267816a350a378ae1ddf1
2017-07-25 12:34:21 -04:00
Stephen Toub 11dea4f52d Disable default proxy credentials tests for managed handler (dotnet/corefx#22495)
One of these tests is now hanging on Unix after the updated connection
pooling changes went in.  Disabling for now.

Commit migrated from https://github.com/dotnet/corefx/commit/5c169a30fb200bd17fb49439c633d2a11773802d
2017-07-21 10:28:50 -04:00
Stephen Toub 01c662fdfd Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/4feb7fa2fcd2a2a4062a3ba8df4a2233d97af644
2017-07-20 17:15:39 -04:00
Stephen Toub 02c844fe4c Remove ManagedHandler files from UnitTests
No need for them to be there.


Commit migrated from https://github.com/dotnet/corefx/commit/76b8639ba439b7b3287c97d3cd1956948c0832f4
2017-07-20 08:01:07 -04:00
Stephen Toub 5f18995584 Improve connection pooling in ManagedHandler
Add support for purging stale connections from the pool and for a max number of connections per server.


Commit migrated from https://github.com/dotnet/corefx/commit/b52ad56a22e4bfabb55adc166396e1221b0e75f6
2017-07-19 23:28:54 -04:00
Stephen Toub a162c3892c Skip assert in Http SSL test on macOS (dotnet/corefx#22305)
Commit migrated from https://github.com/dotnet/corefx/commit/bb455945e6afe35d1b705c3590decdbcbfba5e5f
2017-07-18 11:42:35 -04:00
Stephen Toub fc393e88e9 Assert more details in Http SSL test failure (dotnet/corefx#22303)
Commit migrated from https://github.com/dotnet/corefx/commit/7d7a7efb58a49638e48c560631633730e10674dc
2017-07-15 22:54:00 -04:00
Lakshmi Priya Sekar f828d320fd Disable incompatible test on macos high sierra.
Commit migrated from https://github.com/dotnet/corefx/commit/c6afac0fb789e93431e3940e1ed08a2eabd3c344
2017-07-14 11:09:25 -07:00
Jeremy Barton 993c772595 Make ManagedHandler ConnectionPoolingTest clean itself up (dotnet/corefx#22267)
ManagedHandler_HttpClientHandler_ConnectionPooling_Test didn't assert
IDisposable (though did have a Dispose method), so it didn't clear the
environment variable that says to use the prototype managed handler in tests.
This means that any tests which should still be using the curl provider end up
using the managed provider until another managed test runs.

So now it's disposable, and a failure we were expecting, but not seeing, on
macOS 10.13 is asserting itself again.

Commit migrated from https://github.com/dotnet/corefx/commit/3dac2dbf20a56e6b525e078e977bfeed3ae8de8a
2017-07-14 12:49:38 -04:00
David Shulman 0e9da04ab9 Port TFS WinRT interop tests for HttpClient for UAP (dotnet/corefx#22239)
* Port TFS WinRT interop tests for HttpClient for UAP

Bring over the last of the WinRT interop tests for HttpClient. These
tests deal with interop between WinRT stream classes and .NET stream
classes.

Fixes dotnet/corefx#9044

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/7f4b8837ef77c3784cde0f57d17a5e656df86cb4
2017-07-14 09:01:11 -07:00
Stephen Toub bdc7e48e00 Use a shared MultiAgent in CurlHandler when using LibreSSL backend on macOS (dotnet/corefx#22242)
LibreSSL needs locks initialized in order to be used safely from
multiple threads, which happens when multiple HttpClients are used.  But
we don't currently have a good way to perform that initialization as we
do for OpenSSL.  As a workaround, add a shared MultiAgent that's
initialized when LibreSSL is used on macOS, and use that same MultiAgent
from all CurlHandler instances rather than giving each their own.  Since
MultiAgent is 1:1 with a thread, all HttpClient's will then end up
sharing the same libcurl event loop thread, and we'll serialize all of
our interactions with libcurl and thus hopefully with LibreSSL.

Commit migrated from https://github.com/dotnet/corefx/commit/a26de495ffa390a9d6b3a0d0f338e9d9f97ad5fe
2017-07-13 21:48:10 -04:00
David Shulman 247c84a48c Reconcile behavior of MaxRequestContentBufferSize across .NET Core (dotnet/corefx#22201)
* Reconcile behavior of MaxRequestContentBufferSize across .NET Core

The HttpClientHandler property, MaxRequestContentBufferSize, has been
deprecated. This PR reconciles the behavior of the getter and setter of
the property.

Similar to other decisions in HttpClient PRs with these kinds of
behavior differences, we are not going to throw PNSE. We will document
the differences in the AppCompat docs.

Fixes dotnet/corefx#7879

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/e740973fed660da4426218bf2ec4be35a60ad095
2017-07-13 13:21:41 -07:00
David Shulman b85affb0a9 Adjust Http tests for UAP behavior differences (dotnet/corefx#22193)
Made changes to some UAP tests due to known platform differences.
Differences will be documented in the AppCompat docs.

Opened some new issues for bugs to investigate.

Fixes dotnet/corefx#22159
Fixes dotnet/corefx#22163

Commit migrated from https://github.com/dotnet/corefx/commit/1db009972e87bcdb719954bb6b00e19e67f4860b
2017-07-12 19:17:28 -07:00
David Shulman 9441d0365a Re-enable and fix Http tests for UAP (dotnet/corefx#22155)
* Re-enable anf fix Http tests for UAP

* Removed ActiveIssue from a bunch of Http tests.

* Converted some ActiveIssue to SkipOnTargetFramework due to
platform differences.

* Change some tests to use RemoteInvoke to get process isolation
since UAP will cache connections per-process.

* Removed a duplicate ChannelBinding test. There is already the
same test in HttpClientHandlerTest.ServerCertificates.cs
(PostAsync_Post_ChannelBinding_ConfiguredCorrectly). And that
test checks more things.

Contributes to dotnet/corefx#20010

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/a3cd07a7b608358710ac073cbe41f65866aa929a
2017-07-12 13:26:01 -07:00
David Shulman 113a821137 Fix HttpClientHandler UAP to use a filtered set of client certs (dotnet/corefx#22075)
* Fix HttpClientHandler UAP to use a filtered set of client certs

My earlier PR dotnet/corefx#22022 refactored the GetEligibleClientCertificates code
into a Common method. However, I neglected to actually use it in the UAP
HttpClientHandler!

Fixed the handler to properly filter down the set of client
certificates.

Added new tests to verify functionality. While doing this, I discovered
that the tests need to run in an isolated process due to the per-process
caching behavior of the UAP HTTP stack.

So, I used the RemoteInvoke method. I had to duplicate some of the new
tests using Fact instead of using Theory. This is because the
RemoteInvoke doesn't allow non-string parameters and I had to pass
in X509Certificate2 objects. So, I separated out each variant into its
own Fact test.

* Address PR feedback

* Fix code refactoring to properly filter client certificates.
* Fix test names in nameof() blocks.
* Disable a test from using the managed handler.

* Address PR feedback

* Remove unneeded using statements.
* Disable managed handler in some SslProtocols tests.


Commit migrated from https://github.com/dotnet/corefx/commit/9c4af2973699aea35ce5c60c00f7dd14398e7a14
2017-07-11 16:39:00 -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
Stephen Toub ac9303e990 Disable GetAsync_UnsupportedSSLVersion_Throws test on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/0b3134f7b9a2b2be73dcbfa0deca7a8da24d6621
2017-07-09 00:50:15 -04:00
David Shulman 465f5b4426 Modify some HttpClient tests to use RemoteInvoke on UAP (dotnet/corefx#22000)
* Modify some HttpClient tests to use RemoteInvoke on UAP

A few of the HttpClient tests were failing and needed to be isolated into their
own process. This is due to the UAP stack using per-process connection pooling.

Fixes dotnet/corefx#21945

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/69424bfe32417870a5b3047bad4958cc7fa5d9a8
2017-07-08 10:53:30 -07:00
Stephen Toub e4e0f8e85d Disable ManagedHandler negative test failing on older Windows 10 builds (dotnet/corefx#22002)
Commit migrated from https://github.com/dotnet/corefx/commit/99aa82499ef8fe11e6049a6ba2a636eb8780a520
2017-07-08 00:55:57 -04:00
Stephen Toub b9696b910b Avoid substring allocations for number parsing (dotnet/corefx#21990)
This both avoids substring allocations and is faster than the current calls, at least in microbenchmarks.

Commit migrated from https://github.com/dotnet/corefx/commit/1e16bbac85e83a38f6508abd790cb7d6b3b38db9
2017-07-07 23:57:25 -04:00
Stephen Toub 2fdaa3a056 Avoid forcing response general headers allocation in ConnectionClose
Commit migrated from https://github.com/dotnet/corefx/commit/64540b9bbd698929f9378a5cc6964982963ae9b2
2017-07-07 11:30:10 -04:00
Stephen Toub 220d3bc4f0 Ammortize IdnHost allocations by storing it in HttpConnection
Commit migrated from https://github.com/dotnet/corefx/commit/0d05ea15f1ea5cf384c504f070179376586510fd
2017-07-07 09:09:40 -04:00
Geoff Kizer 3468cf76fb handle Connection: close on response
Commit migrated from https://github.com/dotnet/corefx/commit/5b5fb9f525e97afceeece3be3131f5f60ada55c5
2017-07-07 08:39:46 -04:00
Stephen Toub 783d69cc63 Use pending ReadAsync in ManagedHandler to detect closed connections (dotnet/corefx#21936)
Commit migrated from https://github.com/dotnet/corefx/commit/dc379629280346ddadd6ccbcc879833347271214
2017-07-07 07:32:40 -04:00
David Shulman 729e5773e4 Fix HttpClientHandler ServerCertificateCustomValidationCallback for UWP (dotnet/corefx#21905)
* Fix HttpClientHandler ServerCertificateCustomValidationCallback for UWP

This PR implements the ServerCertificateCustomValidationCallback for UWP. While implementing this, I discovered that the behavior of
the current .NET Core code is incorrect regarding how to propagate exceptions from the user provided callback. I opened up a new
issue dotnet/corefx#21904 and revised the test as well.

Fixes dotnet/corefx#21627

* Address more PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/e30fdc38e60f6fa2ed8e7e103d1f8c44655438cd
2017-07-06 17:22:50 -07:00
Stephen Toub abcb513dde Fix ManagedHandler to support connecting to IPv6 servers (dotnet/corefx#21951)
Also use IdnHost instead of Host, in case the Host isn't DNS-safe.

Commit migrated from https://github.com/dotnet/corefx/commit/45ae10c713f9799f2f47a2c390b30529bd222bac
2017-07-06 16:37:32 -04:00
Stephen Toub da8094f0e5 Wrap CurlHandler cert validation callback exceptions in HttpRequestException (dotnet/corefx#21938)
* Wrap CurlHandler cert validation callback exceptions in HttpRequestException

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/9d74fcf4534894f375caebe20bfe62dd7af7fbd0
2017-07-06 16:37:20 -04:00
Stephen Toub 14de90821d Disable several ManagedHandler tests (dotnet/corefx#21907)
These were enabled as they weren't failing CI, but that's likely because they were being skipped rather than because they actually work.

Commit migrated from https://github.com/dotnet/corefx/commit/4a9d2b80677eb4e51892873b9dafe1fedfaeae22
2017-07-05 19:16:35 -04:00