Commit Graph
13 Commits
Author SHA1 Message Date
Wes Haggard f27c7dc024 Update project files adding default configurations
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
2016-01-02 23:50:21 -08:00
David Shulman eafca6efa3 Fix WinHttpHandler response handling for manual cookie parsing
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
2015-12-17 10:59:08 -08:00
Cristian Pop 40dcf58810 Removing SSLv2 and SSLv3 support from System.Net.Security.
APIs will throw NotSupportedException if SSLv2 or v3 is used. This
behavior is different from .NET Desktop.
Tests have been changed to pin this new behavior.
Increased passing-test timeouts to 15s.

Fix dotnet/corefx#3114 (partial), dotnet/corefx#4467


Commit migrated from https://github.com/dotnet/corefx/commit/1f4deea8946d2e54dfd3c88e64c85bc3c3d9805c
2015-11-16 11:26:00 -08:00
stephentoub 70f11fba60 Remove non-Windows clutter from WinHttpHandler sln/projs
This project is and will always be Windows-specific.  There's no need for
all of the placeholders related to non-Windows targets.


Commit migrated from https://github.com/dotnet/corefx/commit/4b141937a40536536eb43272b45cb0b130079efd
2015-11-05 22:05:33 -08:00
stephentoub ba797defff Replace Substring(...).Trim() with SubstringTrim(...)
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
2015-10-28 12:29:59 -04:00
Pat Gavlin 0ac5f634bc Unify the two definitions of WinHttpException.
Fixes dotnet/corefx#2542.


Commit migrated from https://github.com/dotnet/corefx/commit/2cad4090903ddfd1f11b78156f11bb614f391aa8
2015-10-21 14:56:45 -07:00
David Shulman 4640c3cefb WinHttpHandler uses async WinHTTP patterns
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
2015-10-16 13:33:35 -07:00
David Shulman 180631efc7 Add more WinHttpHandler client certificate tests
Added a fake X509Store to the unit tests. Add tests related to
WinHttpHandler ClientCertificateOption.Automatic property setting.


Commit migrated from https://github.com/dotnet/corefx/commit/58c709f1521ab55a7e358d32bd331987259fdc43
2015-10-09 11:40:04 -07:00
David Shulman 940366be3a WinHttpHandler client SSL certificate fixes and tests
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
2015-10-06 11:27:01 -07:00
David Shulman e0c3d074dd Improve WinHttpHandler and SafeWinHttpHandle reference counting logic
This PR mainly addresses "handle leaks" dotnet/corefx#2963, dotnet/corefx#2762, dotnet/corefx#2793. In investigating the leaks, I discovered that our use of the SafeHandle pattern was not quite right. Native Windows WinHTTP handles wrapped by SafeHandle need additional lifetime management protection to preserve parent-child relationships. Closing the parent handle too early will invalidate the child handle. So, added a SetParentHandle() method to SafeWinHttpHandle to protect against this. This also simplified the passing of handles to the WinHttpResponseStream class.

After adding leak detection, I discovered a race condition caused by an CancellationToken.Register that should not exist in WinHttpHandler.
This inadvertently provided a way for the awaited SendAsync() task to return back to the caller even though the StartRequest() method is still
running.

Added unit tests to validate the behavior assumptions and to track leaks in the WinHttpHandler logic.

This change does not affect the SafeWinHttpHandleWithCallback class that is used by System.Net.WebSocket.Client. But that class is incorrectly using the SafeHandle pattern w.r.t. Dispose() and I will be fixing that in a later PR.


Commit migrated from https://github.com/dotnet/corefx/commit/a75ec027daa53114c788464878e2947ae7d5a65e
2015-09-08 08:27:04 -07:00
Rajan Singh 9b679bfb53 Moving shared default between winHttp & Unix Handler to a seperate common file
Commit migrated from https://github.com/dotnet/corefx/commit/756ed1131ced4649c6a23940b9707012ec1d2ff2
2015-08-17 13:03:42 +05:30
dotnet-bot d47f4c3abf Initial commit of System.Net.WebSockets.Client.
Commit migrated from https://github.com/dotnet/corefx/commit/2f2fae24846c40bc588625b47ec12f43ac323612
2015-07-27 14:41:34 -07:00
David Shulman f5e46293c1 Refactor WinHttpHandler tests for multiple test projects
This change sets up the layout for having multiple test projects for
WinHttpHandler. It follows the current guidlines as well as working
within the BUILDTOOLS requirements of having ".Tests.csproj" for the
names of the projects.

Also, fixed up some cross-platform definitions in the solutions files
for Http and WinHttpHandler.

After this PR is done, we will be migrating a large set of http
functional tests to GitHub


Commit migrated from https://github.com/dotnet/corefx/commit/42d81c41175ab8832032a2a387b8dc58365604a9
2015-07-17 14:16:49 -07:00