Commit Graph
623 Commits
Author SHA1 Message Date
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
Eric Erhardt 1df03e5bbd Rename dir files to Directory.Build
dir.props => Directory.Build.props
dir.targets => Directory.Build.targets


Commit migrated from https://github.com/dotnet/corefx/commit/204a8dbbc23bfc51d419c93f2f2ddaf50db8020f
2018-06-15 17:07:48 -05:00
Eric Erhardt 70091b9c8b Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/ad505eb98c6a887db2d2932fec256d9e4e394169
2018-06-11 17:20:10 -05:00
David Shulman ad9557d3c4 Fix WinHttpHandler when using authenticating proxies (dotnet/corefx#30196)
This was a regression from .NET Core 2.0 due to PR dotnet/corefx#28105.

Proxy authentication using system default proxy settings that involve a PAC file
(either autodiscovery or explicit PAC file) cause a NullReferenceException in WinHttpHandler in the
CheckResponseForAuthentication() method.

This problem is only discovered when using an authenticating proxy server (any auth scheme) that is
discovered using PAC files. This is considered the "system default" proxy. When this occurs, the
handler's Proxy property is null and dereferencing it caused the exception.

Due to the problems described in dotnet/corefx#6997, the uri of the proxy can't be determined yet since it is only
known to WinHTTP. Fixing dotnet/corefx#6997 is complicated and impacts performance. However, in most cases, as
long as the credentials are a NetworkCredential object, knowing the uri of the proxy is needed.

I tested this manually using the steps I described in dotnet/corefx#30191. I did not add any tests to this PR since
they can't be run in CI. However, I am working on a task that will eventually add Enterprise-Scenario
testing like this (PAC files, authenticating proxies, etc.) to our systems.

Fixes dotnet/corefx#30191
Contributes to dotnet/corefx#6997

Commit migrated from https://github.com/dotnet/corefx/commit/69c2e2072574805589becac0c08590dc5e39b65e
2018-06-07 17:31:30 -07:00
David Shulman 8e11e35537 Fix auto decompression behavior in Http handlers (dotnet/corefx#29903)
Fixed a few bugs in both WinHttpHandler and SocketsHttpHandler regarding the behavior of
'Accept-Encoding' request headers and automatic decompression of response body content.

On Windows 7, native WinHTTP doesn't support automatic decompression. That also means it doesn't automatically append 'Accept-Encoding' request headers. WinHttpHandler was relying on WinHTTP to add those headers. But it wasn't happening on Windows 7. So, now WinHttpHandler will make sure those headers are added if not already present. WinHttpHandler was also always decompressing content even when the encodings in the .AutomaticDecompression property didn't match.

SocketsHttpHandler had a different bug. It would make sure that the 'Accept-Encoding' headers were
present when .AutomaticDecompression was being used. But it wouldn't check for existing headers and duplicate encodings would be present in the outbound 'Accept-Encoding' request header.  I.e., it would end up with "Accept-Encoding: gzip, gzip".

In addition to fixing these bugs, I added more tests to both Http Functional and WinHttpHandler Unit
tests (which can simulate running on Windows 7 using the existing mocks).

Fixes dotnet/corefx#29747
Fixes dotnet/corefx#26991


Commit migrated from https://github.com/dotnet/corefx/commit/40ce4cb20270f731d7d826291e1edce8d1ce2c37
2018-05-25 14:48:26 -07:00
wtgodbe f38ceb30be Convert all .csproj files in src to SDK-style projects
Commit migrated from https://github.com/dotnet/corefx/commit/91d7e62bbf28094a2b419b87847bcd6a7658564d
2018-05-21 11:53:46 -07:00
Stephen Toub 9cf4d3bb85 Merge pull request dotnet/corefx#29636 from stephentoub/formatmessage
Improvements to FormatMessage

Commit migrated from https://github.com/dotnet/corefx/commit/48ce3254e28f2dae2d9a5efe7dd42cfab119d287
2018-05-10 22:27:53 -04:00
David Shulman 280b85f227 Add EventSource tracing to WinHttpHandler (dotnet/corefx#29604)
Add EventSource tracing to WinHttpHandler

Removed the custom OutputDebugString-style tracing from WinHttpHandler and replaced it with
NetEventSource. Didn't define any new event id's but tried to use "Info" vs. "Error"
in more places.

Due to the unique way the WinHttpHandler class gets built into two different binaries,
I needed to add a new EventSource name/GUID for the standalone System.Net.Http.WinHttpHandler.dll
binary. The logging output is similar but will show up in either "Microsoft-System-Net-Http" or
"Microsoft-System-Net-Http-WinHttpHandler" EventSource's depending on which binary is being used,
i.e. whether "new HttpClientHandler()" or "new WinHttpHandler()" was used.

For those curious about how the new GUID for "Microsoft-System-Net-Http-WinHttpHandler" was done, it
was not generated randomly. EventSource GUID's are generated based on the string name for the
EventSource according to a well-defined formula. Doing a construct like this will return back the
information:

```c#
Type esType = typeof(WinHttpHandler).GetTypeInfo().Assembly.GetType("System.Net.NetEventSource", true, false);
Console.WriteLine($"Name={EventSource.GetName(esType)}, Guid={EventSource.GetGuid(esType).ToString()}");
```

Closes dotnet/corefx#7856


Commit migrated from https://github.com/dotnet/corefx/commit/11222269ae3bc45cd414dcb973f2d92f1bad73f8
2018-05-10 14:33:25 -07:00
Stephen Toub 4dbf9094c2 Use FORMAT_MESSAGE_ALLOCATE_BUFFER with FormatMessage
Avoid looping and growing a managed heap buffer when we can instead just ask the native side to allocate one of the right size for us.


Commit migrated from https://github.com/dotnet/corefx/commit/e118304d264163f03e79965e4f2ab1d5c1a43961
2018-05-10 16:38:16 -04:00
Stephen Toub 4dafdf5211 Replace shared Interop.FormatMessage.cs with non-shared one
Commit migrated from https://github.com/dotnet/corefx/commit/f3414d6cc3463b9e243e5d732d7e401c2d037d05
2018-05-10 16:03:31 -04:00
David Shulman 264474f8a3 Removed duplicated type HttpVersionInternal (dotnet/corefx#29545)
Removed duplicated type HttpVersionInternal

We added HttpVersionInternal back when it differed from the System.Net.Primitives HttpVersion type. But now that the two types are the same, we can remove the duplicated internal type.

Fixes dotnet/corefx#26492


Commit migrated from https://github.com/dotnet/corefx/commit/40faa4ed5c699e84afbb78f6ff96feb7b99db320
2018-05-07 14:00:19 -07:00
Dan Friedman 33591df321 Clean dead code System.Net* (dotnet/corefx#29302)
* Clean dead code in System.Net

* More cleaning

* Clean dead code for HttpListener

* Clean dead code for Mail

* Clean dead code in Http

* Clean dead code for NetworkInformation

* Clean more dead code

* Various fixes

* Build fix

* Restore field

* var -> string


Commit migrated from https://github.com/dotnet/corefx/commit/71cc1ae8ba02b7b71878cb69a50c667c8ed0f50f
2018-05-01 16:49:12 -07:00
Wes Haggard fc526e8605 Bump assembly versions for libraries with packages
Commit migrated from https://github.com/dotnet/corefx/commit/6a1b5c0aeee747a535579da7374c05b8d878fb65
2018-04-27 14:56:18 -07:00
Marco Rossignoli 87da9705a6 De-duplicate resource ID's to make Mono merge easier (dotnet/corefx#29280)
* wip

* wip

* wip

* fix System.Linq.Expressions

* revert for tests

* add powershell script

* address PR feedback

* address PR feedbacl

* address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/5a37188238e90d8566e6161b43ac483a671bb7d2
2018-04-24 13:58:42 -07:00
Marco Rossignoli 528e91dabf Replace identical files with CoreLib mirror (dotnet/corefx#28593)
Commit migrated from https://github.com/dotnet/corefx/commit/5041dbb272ae05b360db538cf62fc2847277fd7e
2018-04-17 16:05:44 -07:00
Marco Rossignoli 20e05bb5cd Pass Uri.IdnHost to WinHttpConnect (dotnet/corefx#28849)
* pass IdnHost

* add manual functional test

* cleanup

* fix comment

* address PR feedback

* address PR feedback

* address PR feedback

* address PR feedback

* address PR feedback

* address PR feedback

* address PR feedback

* fix IPv6 IdnHost

* address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/b2893f07cf61dae81d424dd676a0d903a36a10c2
2018-04-17 09:55:34 -07:00
David Shulman ec81e61c40 Optimize proxy PAC file discovery process for SocketsHttpHandler (dotnet/corefx#29050)
This PR will reduce the calls to WinHTTP GetProxyForUrl() if a previous call recently discovered
no PAC file within a certain timeframe. We call this API when "Automatically detect settings"
is turned on. The default configuration on Windows has this proxy setting always turned on. This
is ironic given that most network environments don't have a PAC file on the network. So, it's
important to try to optimize this common case on customers' networks.

Initial testing shows at least a 2x speed improvement with these changes.

I did not use any locking mechanisms since those would drag down performance. In the worst case,
any race condition would mean we might call GetProxyForUrl() an extra time. But since we're only
filtering on ERROR_WINHTTP_AUTODETECTION_FAILED, it is unlikely to actually change over time.
That particular error means that the WPAD protocol was able to complete on the network, but the
answer discovered is that there is no PAC file registered on the network.

Fixes dotnet/corefx#28543


Commit migrated from https://github.com/dotnet/corefx/commit/712d3065cef7f28eae96a578b8bd73870e9b2cd5
2018-04-12 17:13:22 -07:00
Jan Kotas 0c82fdc6cb Simplify sspicli interop marshaling (dotnet/corefx#29031)
* Delete unnecessary wrapper

* Simplify sspicli interop marshaling

This makes it both faster and more AOT friendly

* CR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/437e8823028d09ad5c62ec71e2393417e3f7130c
2018-04-11 18:28:51 -04:00
Stephen Toub fd20c03b0c Stop blocking explicit opt-in to Ssl2/3 in SslStream and HttpClient (dotnet/corefx#28639)
By default, .NET Core defaults to allowing TLSv1, TLSv1.1, and TLSv1.2.  However, whereas .NET Framework allows a developer to opt-in to SSLv2/SSLv3, .NET Core currently blocks it.  This means developers are unable to use .NET Core when they need to communicate with an endpoint they don't control and that's unfortunately limited to one of these protocols, which blocks adoption of .NET Core.

This commit stops blocking these protocols.  They're still disabled by default, and compiling against them still results in a deprecation warning, but if a developer chooses to ignore the warning and explicitly sets SslProtocols, they are at least able to use the protocols, subject to whatever the underlying operating system allows (e.g. Windows stops supporting SSLv2 as of v1607).

Commit migrated from https://github.com/dotnet/corefx/commit/3cc6fda0c6abe76eea222c165ebdf816e83df564
2018-03-30 22:00:37 -07:00
David Shulman 1e1b3a1e05 Fix WinHttpHandler error handling (dotnet/corefx#28367)
This PR addresses some error handling problems in WinHttpHandler as well as
improves the error messages generated for WinHttpException.

This was root caused to a bug in WinHttp where it can't do a GET request with a
request body using chunked encoding. However, this exception was masked due to
an error handling bug caused by an inconsistency in how WinHttp associates
context values for callbacks during the WinHttpSendRequest API call. This PR now
fixes the error handling around synchronous errors being returned from
WinHttpSendRequest. The root WinHttp bug itself can't be fixed. So, doing a GET request
will still throw an exception, but it will be a catchable HttpRequestException.

Another bug was discovered while investigating dotnet/corefx#26278. WinHttpCloseHandle should only be
called once and should never race between threads. This is normally protected when
the request handle is closed via SafeHandle Dispose(). But there was a place in the
callback method where we called WinHttpCloseHandle directly against the raw handle.

Finally, the error messages for WinHttpExceptions have been improved to show the
error number and the probable WinHttp API call that generated the error. This will
save diagnostic time.

I also moved the WinHttpException source code back from Common. It was originally shared
between WinHttpHandler and ClientWebSocket. But then ClientWebSocket moved away from
WinHttp implementation. So, it makes more sense for this class to be under WinHttpHandler.

Example:

Original WinHttpException message: "The parameter is incorrect"
New WinHttpException message: "Error 87 calling WinHttpSendRequest, 'The parameter is incorrect'."

Closes dotnet/corefx#28156
Contributes to dotnet/corefx#26278


Commit migrated from https://github.com/dotnet/corefx/commit/ce4ebdfbf2080a38855ab8df5c9bb553db8724af
2018-03-22 12:58:54 -07:00
Stephen Toub a1954a0cac Merge pull request dotnet/corefx#28134 from stephentoub/connectionallocs
Remove some low-hanging fruit allocations from SocketsHttpHandler connections

Commit migrated from https://github.com/dotnet/corefx/commit/c533892f2e57940ec9e66616288bf340b75a9217
2018-03-17 00:36:46 -04:00
Max Kerr afb835886e Check available credentials when choosing authentication scheme (dotnet/corefx#28105)
When choosing what authentication scheme to use, WinHttpHandler picks the most secure scheme supported by the server. When the client does not support this scheme it closes the connection. This fix updates the authentication logic to instead pick the most secure scheme offered by the server that is also supported by the client.

This change also adds a test of the relevant behavior.

Fixes: dotnet/corefx#27672

Commit migrated from https://github.com/dotnet/corefx/commit/6d031a04f3df8fadd5b82d9c23d904182eea94e4
2018-03-16 14:35:50 -07:00
Stephen Toub e62c34ceed Avoid StringBuffer allocation in Interop.Kernel32.GetMessage
And use it from X509Chain.ChainStatus rather than its own FormatMessage DllImport.  Normally we don't care as much about exceptional paths that FormatMessage would be used on, but it shows up on success paths with X509 where certificate validation failures are known and ignored by a custom validation routine.


Commit migrated from https://github.com/dotnet/corefx/commit/98227f1a18c1859c5614a0f045a09660f34e6cc1
2018-03-16 10:27:01 -04:00
Max Kerr 5953018eb9 Log when an insecure Https -> Http redirect is blocked (dotnet/corefx#27077)
.NET Core does not allow insecure redirects from https to http, but .NET Framework does. Developers have had some trouble diagnosing the issue when they run into this difference. This change adds logging to help developers track down what is going on.

Commit migrated from https://github.com/dotnet/corefx/commit/1fd7d79fc36ca113bdabbee4204e15ae5bcde24a
2018-02-20 14:31:16 -08:00
Stephen Toub 8f3ddb7597 Enable SocketsHttpHandler cancellation support (dotnet/corefx#27029)
* Enable SocketsHttpHandler cancellation support

This change significantly improves the cancellation support in SocketsHttpHandler.  Previously we were passing the CancellationToken around to every method, eventually bottoming out in calls to the underlying Stream which then ends up passing them down to the underlying Socket.  But today Socket's support for cancellation is minimal, only doing up-front checks; if cancellation is requested during the socket operation rather than before, the request will be ignored.  Since HttpClient implements features like timeouts on top of cancellation support, it's important to do better than this.

The change implements cancellation by registering with the CancellationToken to dispose of the connection.  This will cause any reads/writes to wake up.  We then translate resulting exceptions into cancellation exceptions.  When in the main SendAsync method, we register once for the whole body of the operation until the point that we're returning the response message.  For individual operations on the response content stream, we register per operation; however, when feasible we try to avoid the registration costs by only registering if operations don't complete synchronously.  We also account for the case that on Unix, closing the connection may result in read operations waking up not with an exception but rather with EOF, which we also need to translate into cancellation when appropriate.

Along the way I cleaned up a few minor issues as well.

I also added a bunch of cancellation-related tests:
- Test cancellation occurring while sending request content
- Test cancellation occurring while receiving response headers
- Test cancellation occurring while receiving response body and using a buffered operation
- Test that all of the above are triggerable with CancellationTokenSource.Cancel, HttpClient.CancelPendingRequests, and HttpClient.Dispose
- Test cancellation occurring while receiving response body and using an unbuffered operation, either a ReadAsync or CopyToAsync on the response stream
- Test that a CancelPendingRequests doesn't affect unbuffered operations on the response stream

There are deficiencies here in the existing handlers, and tests have been selectively disabled accordingly (I also fixed a couple cases that naturally fell out of the changes I was making for SocketsHttpHandler).  SocketsHttpHandler passes now for all of them.

* Add test that Dispose doesn't cancel response stream


Commit migrated from https://github.com/dotnet/corefx/commit/53be85c2fe473fdea8c001e3d9fd81dd478b858e
2018-02-13 16:30:34 -05:00
Stephen Toub f8e6f41b81 Clear initlocals in a bunch of assemblies (dotnet/corefx#26993)
* Clear initlocals in a bunch of assemblies

Sets
```XML
<ILLinkClearInitLocals>true</ILLinkClearInitLocals>
```
for the assemblies:
    - System.IO.FileSystem
    - System.IO.Pipes
    - System.Memory
    - System.Net.Http
    - System.Net.Http.WinHttpHandler
    - System.Net.NameResolution
    - System.Net.NetworkInformation
    - System.Net.Primitives
    - System.Net.Requests
    - System.Net.Security
    - System.Net.Sockets
    - System.Net.WebSockets
    - System.Net.WebSockets.Client
    - System.Net.WebSockets.WebSocketsProtocol
    - System.Private.Uri
    - System.Runtime
    - System.Runtime.Extensions

Eventually we'd ideally set the flag for the whole repo; these are just the ones I audited thus far.  In a few cases I had to make code changes to adapt, where the code was expecting stackallocs to be cleared.  I also looked at a few other projects (System.Collections, System.Runtime.Numerics) where there were more significant dependencies on clearing and I decided to leave those for later.

* Disable ILLinkClearInitLocals running on Unix until it works there


Commit migrated from https://github.com/dotnet/corefx/commit/f0a032e4a1c8a848574a5db3e69e8a6fa0aae91e
2018-02-13 06:30:25 -05:00
Max Kerr 717083f0d4 Clear Authorization Headers on Redirect (dotnet/corefx#26864)
When a user has added an Authorization header to a request via the HttpClient DefaultRequestHeaders Authorization field, ensure that header is stripped on redirect.

This change adds a method to strip Authorization headers that were set via the HttpClient DefaultRequestHeaders Authorization field, and calls that method on redirect. In addition, it adds a test to ensure that this behavior occurs as expected.

The new method ResetAuthRequestHeaders is based on the method ResetCookieRequestHeaders, which is used to reset cookie headers on redirect.

The issue also occurs in CurlHandler, but the fix is slightly different. Rather than remove the headers that have already been set, we can instead just skip them when copying over the new headers to the redirected request.

Fixes dotnet/corefx#26426

Commit migrated from https://github.com/dotnet/corefx/commit/7e6396b2bcb4d372b199cfb7b3b13e290c441124
2018-02-12 11:28:09 -08:00
Paulo Janotti 3291b94ec7 Test: ignore specific WinHttpException on old Windows versions (dotnet/corefx#26428)
The root cause issue was already fixed in Windows but old versions still
hit this issue. This change makes the failing test to ignore the known
issue on these old Windows versions.

Fixes dotnet/corefx#7812 (just so GH closes the issue at merge time, the actual issue
was fixed in Windows).

Commit migrated from https://github.com/dotnet/corefx/commit/f345a2251bcb57d3a64e03efc63dafb76319dc20
2018-01-19 09:58:49 -08:00
David Shulman a10c42c864 Wrap cert callback leaked exceptions in WinHttpHandler (dotnet/corefx#24107)
Similar to the fix done for CurlHandler (dotnet/corefx#21938), fix WinHttpHandler so
that leaked exceptions from the user-provided certificate callback are
properly wrapped.

The ManagedHandler still needs to be fixed since it is not wrapping
properly.

Contributes to dotnet/corefx#21904

Commit migrated from https://github.com/dotnet/corefx/commit/ca5d83ec2855afa7ce4f60d9c5b0dd46e1cb2faf
2017-09-17 23:19:28 -04:00
David Shulman 9c7d6e1198 Fix WinHttpHandler when building certificate chain (dotnet/corefx#23951)
* Fix WinHttpHandler when building certificate chain

Unlike SslStream, WinHttpHandler was not using all the certificates
obtained from the TLS/SSL handshake when building the chain. In
addition to the end-entity server certificate, there were other certs
available in the native cert handle that could be passed along
to the chain build operation.

As part of fixing this, I refactored the Common schannel and crypto
interop code so that it can be used in both SslStream and
WinHttpHandler.

I tested this manually because this cannot be easily tested in the CI
system. Added traces in WinHttpHandler to support this.

Fixes dotnet/corefx#23827
Fixes dotnet/corefx#4473

* Address PR feedback

Check for null IntPtr.


Commit migrated from https://github.com/dotnet/corefx/commit/dcc29528c9c4633e81b1937e7dd9fde7115a938c
2017-09-12 10:12:24 -04:00
Wes Haggard ee1e153dc1 Update harvest paths for new stable packages
Commit migrated from https://github.com/dotnet/corefx/commit/4deb3b587c4cf9788c5af137c47c9a2607d817d1
2017-07-31 11:34:06 -07:00
Stephen Toub 756b70dc83 Fix null dereference in WinHttpResponseStream (dotnet/corefx#22175)
* Fix null dereference in WinHttpResponseStream

If the response stream is disposed of while an operation like CopyToAsync is in flight, a subsequent cancellation request can trigger a null dereference in CancelPendingResponseStreamReadOperation.  While this may not be desirable interaction, we should be more robust against it.

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/035b1e367c18db600c9d7158102fd2ab4e7a7ed2
2017-07-12 18:47:43 -04: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
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
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
Jon Guy 7f7db2a14a Unable to make https request when Oid lookup takes too long (dotnet/corefx#21320)
* Using alternative Oid constructor

This alternative contructor will avoid trigging a potentially costly
lookup for the friendly name associated with the OID.

* Alternative way to lookup OID

This method avoids the AD lookup, while also not making any localization
assumptions

* fix typo

had the wrong OID for Server Auth

* Optional parameter on FromOidValue to disable AD search

New optional parameter on FromOidValue to disable lookup, update server
auth OID lookup in WinHttpCertificateHelper and SecureChannel to use
this new parameter when doing lookup

* Revert "Optional parameter on FromOidValue to disable AD search"

This reverts commit dotnet/corefx@6d0fd6df3d.

* Limit Server Auth OID lookup to local machine

Same change as what was made to SecureChannel class to avoid OID lookup
via AD

* Use alternative OID contructor

Use OID as friendly name to avoid lookup as well as localization issues


Commit migrated from https://github.com/dotnet/corefx/commit/81f80a8a0088d482afdb077b23f21a3e75a1c30c
2017-07-03 18:42:48 -07:00
Hugh Bellamy 98b18432b7 Move AssertExtensions to Corefx.Private.TestUtilities (dotnet/corefx#21799)
* Move AssertExtensions to Corefx.Private.TestUtilities

* Update csprojs

* Fix Linq.Expressions uapaot build


Commit migrated from https://github.com/dotnet/corefx/commit/7e3b0db2892c56a431f8e99af9cd9381adec385a
2017-07-03 09:27:30 -07:00
Stephen Toub 04842ec6d6 Address some previous PR feedback
- Change HttpConnectionKey's hash code
- Avoid redirectCount overflow in SendAsync
- Handle response HTTP versions other than 1.1
- Use GetHeaderValue from Windows implementation


Commit migrated from https://github.com/dotnet/corefx/commit/dd5208c4c3e8f49b895fbe32282975e3dd283a7e
2017-06-26 23:01:42 -04:00
David Shulman 3851bde2ca Disable WinHttpHandler tests on UAP/UAPAOT
System.Net.Http.WinHttpHandler is only meant for use on .NET Framework
and .NET Core but not for UWP apps.

Fixes dotnet/corefx#21438


Commit migrated from https://github.com/dotnet/corefx/commit/14b74f78f375dddf95d55ad2ac2cbe0f0f49de1f
2017-06-25 11:53:54 -07:00
Hugh Bellamy 7cbcd5ed85 Convert most Assert.Throws<ArgumentException> without param name to AssertExtensions (dotnet/corefx#21455)
* Registry

* Collections

* ComponentModel

* Configuration

* Data

* Globalization

* Drawing

* Diagnostics

* IO

* Linq

* Add System.Net param names in tests

* Move ArgumentExceptions in System.Private.Xml to AssertExtensions

* Add System.Reflection.* ArgumentException param names

* Add param names for System.Runtime* ArgumentExceptions

* Add ArgumentException param names to System.Security.*

* Add ArgumentException param names to System.Text.*

* Add param names to ArgumentExceptions in misc projects

* Add System.Threading.* ArgumentException param names

* Fix missing files

* Fixes for unix and netfx

* Fix more failures and revert a IdnaConformance tests to avoid merge conflicts with dotnet/corefx#21463


Commit migrated from https://github.com/dotnet/corefx/commit/59915687bb261efeae70565d0ca8990ac45ceb9c
2017-06-23 12:33:47 -07:00
David Shulman 448f50aa8d Fix HTTP/2 option setting in WinHttpHandler
The WinHTTP team has recommended that we always set the HTTP/2 options
explicitly when setting up the WinHTTP request handle. Future versions
of Windows might adjust the WinHTTP default value for this setting.
So, by always setting the value at the WinHTTP layer, we can ensure
that we have a stable default value at the .NET layer.


Commit migrated from https://github.com/dotnet/corefx/commit/d553cb46c0da91406e55b756160cfa87e2ee2f68
2017-06-09 08:44:03 -07:00
David Shulman 7991f4d912 Fix WinHttpResponseStream when reading 0 bytes
Fixes dotnet/corefx#20676


Commit migrated from https://github.com/dotnet/corefx/commit/f6e51aec3270102234386454063d66251f3b901b
2017-06-05 10:43:39 -07:00
Eric St. John af1d155bf6 Remove help VS comments
Many CSProjs included the comment
`<!-- Help VS understand available configurations -->`

These aren't handled well by the tooling that rewrites projects and weren't providing much value.

Remove them.


Commit migrated from https://github.com/dotnet/corefx/commit/5ba948d13e3177c2c7075b6b00791e574bfa0860
2017-05-25 11:10:27 -07:00
Caesar Chen abdd0efdda delete a wrong assert
Commit migrated from https://github.com/dotnet/corefx/commit/c8aa79e486855542f0db7cf28438c752f5c2c8e4
2017-05-22 21:23:23 -07:00
Caesar Chen bcf2c19a0a address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/47043bf23538d31cc9d2eb567166afb7a20713d3
2017-05-22 10:52:24 -07:00
Caesar Chen 97abb996fd address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/6cb9019fa80591c0a714354f36a607be0ddb7c49
2017-05-21 16:48:19 -07:00
Caesar Chen bdcbb5bf95 change error message
Commit migrated from https://github.com/dotnet/corefx/commit/485d6b2e583b103eae6e352947de3b4ae3308189
2017-05-19 15:44:03 -07:00
Caesar Chen a3ecd08fed add if DEBUG
Commit migrated from https://github.com/dotnet/corefx/commit/b991a4101f6d415c502bd303395bc4f4abbb8d8f
2017-05-19 15:33:59 -07:00
Caesar Chen 7d8db04de1 address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/1f9e38f8518eb1bb98f0c12effacb4da73e9fbfc
2017-05-19 15:21:38 -07:00
Caesar Chen 37f01c684f fix comment
Commit migrated from https://github.com/dotnet/corefx/commit/0aa434111f18f359da487228835d7bd0509ec5ae
2017-05-19 13:48:07 -07:00