- Fix Assert that was throwing in a background thread due to mistmatched type (it was looking explicitly for HttpResponseMessage rather than any type in its inheritance hierarchy, and CurlHandler uses a derived type).
- Update project.json package versions
- Unsubscribe the listener when done with it
Commit migrated from https://github.com/dotnet/corefx/commit/9a8d97852bcce9be0b4b6b5eff5ed87f4e36119e
Some fixes (adding imports, adding Platforms package) were tooled, but more complex ones (forking project.jsons, editing csproj's) were not.
Also makes dependency version validation rules case-insensitive. (I used this fix to update the versions of some packages.)
[tfs-changeset: 1573868]
Commit migrated from https://github.com/dotnet/corefx/commit/84af04317505d48feaa1e83dd5dc27ddc0f6de76
This add a default configuration before the Import of dirs.props
for any projects that don't have Debug as the default configuration.
Removed Configuration and Platform properties set after dirs.props
as they would have no affect and just cause confusion.
Removed OutputType=Library property as it isn't necessary.
Commit migrated from https://github.com/dotnet/corefx/commit/9e1da13cf6d5ff4b37b1867beb3411a2fe61da6a
WinHttpHandler was losing 'Set-Cookie' response headers during auto redirection handling when the handler was in 'manual cookie' mode. I.e. `CookieUsePolicy.UseSpecifiedCookieContainer`. This is the only mode that HttpClientHandler uses.
The 'Set-Cookie' headers were currently only parsed out when a final HTTP response happened. This meant that 'Set-Cookie' headers present in interim 3xx redirection responses as well as interim 401, 407 auth responses would not be stored into the CookieContainer. Hence, those same cookies could not be sent back to the server when needed.
The fix is to make sure we parse out the 'Set-Cookie' headers whenever we get an HTTP response back from WinHTTP. As part of this fix, I re-factored out the cookie handling code into a separate class. I also added specific WinHttpHandler tests for the two different cookie modes as well as a HttpClientHandler test to validate cross-platform (i.e. CurlHandler).
Address dotnet/corefx#4960 but further fixes are needed for *NIX as well.
Commit migrated from https://github.com/dotnet/corefx/commit/8ac944afcbd35d8b489e14e1c4c7f4be08f74c72
.NET Stream.Read() semantics leave it to the implementation to decide how much data to return given a buffer of size N:
https://msdn.microsoft.com/en-us/library/system.io.stream.read(v=vs.110).aspx
"An implementation is free to return fewer bytes than requested even if the end of the stream has not been reached."
The behavior of System.Net HTTP APIs (i.e. .NET Framework) are such that stream reads are able to return as soon as data is available. They don't wait until the provided buffer is full. The current WinHttpHandler was not behaving that way because it didn't call WinHttpQueryDataAvailable before calling WinHttpReadData. WinHttpQueryDataAvailable would indicate how many bytes can be read immediately.
This fix changes the WinHttpResponseStream.Read* methods to use WinHttpQueryDataAvailable before calling WinHttpReadData.
Added both WinHttpHandler unit tests (helps with simulating/testing network errors) and HttpClientHandler functional tests (which will test x-plat).
Fixesdotnet/corefx#1825
Commit migrated from https://github.com/dotnet/corefx/commit/5386014a6b74a8d38010b244f9e9ced96df53b69
System.Net.WebHeaderCollection already had a SubstringTrim helper that's used instead of Substring(...).Trim() to avoid first creating the substring and then trimming it, instead just offsetting the startIndex and length appropriately to do the Substring once.
I've factored this helper out into Common, added unit tests, cleaned it up a bit, and used it in several more places in System.Net.
Commit migrated from https://github.com/dotnet/corefx/commit/4e45e641c9d97c3a5d3b6fec4f6ffc33a2405fee
A change was made to DNX to no longer restore project.jsons
that are in nested folders. This caused my batch update to miss
a number of tests and reference assembly projects.
This fixes the stale lock files, but restore is still broken.
[tfs-changeset: 1540448]
Commit migrated from https://github.com/dotnet/corefx/commit/3622cccc1b22fa1947a72d5126b59864e9d2fd0d
We need a new DNX to understand the latest packages.
We also need to move all "dotnet" projects to use dotnetX.X (generations)
now that the packages no longer have "dotnet" assets.
The new version of DNX dropped support for the aspnetcore
so I needed to update a few projects/packages that depended
on old package versions that had this moniker.
[tfs-changeset: 1540388]
Commit migrated from https://github.com/dotnet/corefx/commit/38f8d7a3ca1ee819c2b8eabb1c07ee4e99683c97
This is a large PR and addresses work item dotnet/corefx#3000. I apologize for not being able to structure it in a series of smaller commits.
The bulk of this PR is switching WinHttpHandler to use the async pattern of calling WinHTTP APIs. This involved a significant restructuring of the code. As part of that, I split up the large WinHttpHandler class into multiple, smaller, helper classes.
While the intent of using async WinHTTP calls is better performance and cancel-ability, this PR has not been fully optimized yet. Due to the schedule of RC1 code complete next week, it's important that this PR get in and get mileage on it in the next few weeks.
There are several TODO items that will be done in later PR's. There is still work being tracked in dotnet/corefx#2165 for various follow-up items. For example, re-conciling the best SafeHandle pattern to use for WinHTTP between WebSockets.Client and WinHttpHandler.
I'm currently using a simple Debug.WriteLine for verbose debug logging which can be turned on/off via environment variable. I plan to switch this to System.Net ETW trace loggers in the next commit and/or PR. But the logging has proved very useful in diagnosing issues.
Please provide feedback. Depending on the feedback, some of it will be marked as follow-up items for future PRs.
Commit migrated from https://github.com/dotnet/corefx/commit/d8e5371a5d0f9f4bb3aa85127cb78adf89dde1fb
Turned on tests:
SendAsync_NoWinHttpDecompressionSupportAndResponseBodyIsDeflateCompressed_ExpectedResponse
SendAsync_NoWinHttpDecompressionSupportAndResponseBodyIsGZipCompressed_ExpectedResponse
since the issue with clrcompression.dll was resolved a while ago.
Removed a *Nix annotation suppressing a unit test. This is not needed in
the test sources since the WinHttpHandler library and tests are only
supported on Windows and won't run anymore in CI (disabled in CSPROJ
files) for non-Windows platforms.
Commit migrated from https://github.com/dotnet/corefx/commit/b652828b662f0052deeddea9151f34fccafe3d2a
Fixed a couple of bugs discovered in WinHttpHandler where it was not
sending out client SSL certificates. Changed the final parameter to the
X509Certificate2Collection.Find() method to false. I had originally set
this parameter to true. The parameter tells the .Find() API to only
select "valid" certificates from the collection. The problem is that
"valid" also means "trusted by the client". But a lot of client SSL
certificates are not trusted by the client. They are only trusted by the
server since many servers issue client certificates based on a different
trust root.
Added more tests for client SSL certificates.
Commit migrated from https://github.com/dotnet/corefx/commit/4fa89d2b9b8949bdb261909748808180f2fe1ef5
* Add more tests ported from the internal ToF tests.
* Cleanup existing tests to be consistent in style and format as it has
drifted due to many different people working on the tests.
* Disposing the HttpClient object will dispose the handler as well so we
don't need multiple 'using' statements unless we are explicitly testing
dispose ordering semantics.
Commit migrated from https://github.com/dotnet/corefx/commit/ad55c1d5685afc4009cb2481fcc7c5e4f4a551f8
`build.cmd /p:LockDependencies=true` was the start of this change, but some errors with xunit build numbers led to all xunit upgrades being reset back to what they had in master.
project.json changes:
* System.Net.Security\src Switch off of explicit beta versioning, use the same baseline as everyone else. The S.S.C.Algorithms explicit upgrade is no longer required.
* System.Net.Requests\tests didn't build. Looking at the project.lock.json change, it appeared that a System.Net.Http reference was lost, restored it.
* System.Net.Http\tests didn't build. Looking at the project.lock.json change, it appeared that a System.IO.FileSystem reference was lost, restored it.
* System.Net.WebSockets.Client\src didn't build. Looking at the project.lock.json change, it appeared that a System.Collections (4.0.10) reference was lost, restored it.
* System.Diagnostics.TextWriterTraceListener\tests needed the runtime reference to load the correct System.Diagnostics.TraceSource binary.
Commit migrated from https://github.com/dotnet/corefx/commit/cec3a0f2db542bfa9d9c56bf988d966eacc35ad9