Commit Graph
177 Commits
Author SHA1 Message Date
Eric Erhardt 9a1e6ee2fe Respond to PR feedback.
- Rename Interop.LibCurl to Interop.Http.
- Rename EasyPause to EasyUnpause, since that is what the method does.
- Removed usages of macros in native code.
- Changed managed libcurl constants to use enums.


Commit migrated from https://github.com/dotnet/corefx/commit/02d0b755cfb2b84fa27d48a064d5a5e6b81f9311
2015-10-29 22:01:03 -05:00
Eric Erhardt 5e7c3a08d2 Add shims for libcurl curl_easy_* functions.
Also adding PAL enums for any constants needed for those easy functions.


Commit migrated from https://github.com/dotnet/corefx/commit/6d307afc351901490891702a6a1d98551f3061fa
2015-10-29 18:53:43 -05:00
Eric Erhardt 3598370216 Add shims for Interop.libcurl_slist.cs functions.
Commit migrated from https://github.com/dotnet/corefx/commit/1a8f6cdc72d7281aeb520b251eb3dead3b011b96
2015-10-29 18:52:52 -05:00
bartonjs 0f9757fb70 Handle CURLE_UNKNOWN_OPTION when registering HTTPS callbacks on older versions of curl.
Prior to curl 7.39 the case label for CURLOPT_SSL_CTX_FUNCTION was compiled out, resulting in CURLE_UNKNOWN_OPTION.  In 7.39 they changed it to always present, but reporting CURLE_NOT_BUILT_IN when the backend SSL provider didn't support that callback.

The code was written based on the behavior of curl 7.43, so didn't know about the legacy behavioral difference.


Commit migrated from https://github.com/dotnet/corefx/commit/e5bf4763ce60bf50c36c2d473baaee76f09c740c
2015-10-29 14:45:18 -07: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
Stephen Toub e89a783d4b Merge pull request dotnet/corefx#4121 from bartonjs/unix_https_validation
Make Unix HttpClient use X509Chain instead of the default chain validator

Commit migrated from https://github.com/dotnet/corefx/commit/bd5ff4476937dc236585e9f7eef703f7dcd74979
2015-10-28 12:19:15 -04:00
Eric Erhardt 79b1558439 Merge pull request dotnet/corefx#4186 from eerhardt/ShimLibCurl
Add shim for libcurl version info.

Commit migrated from https://github.com/dotnet/corefx/commit/8924a5c367ce53c8bcb60cd44ccbf37e0a3fcf6a
2015-10-28 10:03:09 -05:00
Eric Erhardt be8a75b758 Add shim for libcurl version info.
Adding a native shim for curl_version_info and removing the managed constants that are no longer needed.


Commit migrated from https://github.com/dotnet/corefx/commit/18d5afe0c3b910e90a8d53807d1e29d104db06ba
2015-10-28 09:12:15 -05:00
stephentoub 2a4056ca09 Trim response headers in CurlHandler
Apply same header response trimming done by WinHttpHandler.
Fixes dotnet/corefx#4187

(At some point I'd like to go through and replace all Substring(...).Trim() calls with a more efficient SubstringTrim(...) that doesn't allocate an intermediate string.  But in the meantime, this addresses the problem.)


Commit migrated from https://github.com/dotnet/corefx/commit/a5053a14559ea30d224bf9f74892c86435d9166b
2015-10-27 22:47:56 -04:00
David Shulman 989c6f95bc Address PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/d9842e88757ebc10c472d96008ec6b627433219f
2015-10-27 17:26:12 -07:00
David Shulman a0239a721e Disable tests on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/ae49b8e5428e509920b722912649e9a733cd1a3d
2015-10-27 16:51:09 -07:00
David Shulman 4b3de626c1 Removed commented-out code.
Commit migrated from https://github.com/dotnet/corefx/commit/79e3350eec6c9fdee9081f9d3dd8b42fe574ada3
2015-10-27 15:29:43 -07:00
David Shulman c8432253b4 Add HttpClient tests to support all HTTP verbs
Added tests for validating against all standard and custom HTTP verbs. These tests use the new networking test server.

Cosolidated some existing tests that were duplicative. More test porting and reorganzing will be done in later PRs.


Commit migrated from https://github.com/dotnet/corefx/commit/057f0a9bc938606f9e3a24a51f64f3a4fd9bbb55
2015-10-27 15:03:29 -07:00
bartonjs 2a30a1d8c8 Make CurlHandler use X509Chain to validate the chain.
libcurl+openssl defaults to just using X509_verify_cert, and the chain that came with the TLS handshake.

The X509Chain class has support for a user-defined trust list, downloading intermediate CA certs, and downloading CRLs (which isn't utilized in this change).

The existing approach was not doing CRL checking, and since the Unix X509Chain implementation does not support opportunistic CRL checking, this change leaves that functionality disabled.


Commit migrated from https://github.com/dotnet/corefx/commit/0ac85cd61e98ab684278dc3fe7a882623e207828
2015-10-27 09:52:17 -07:00
Hemanth Kapila 740209c940 Fix CurlHandler for http TRACE method
TRACE should not upload content.


Commit migrated from https://github.com/dotnet/corefx/commit/5875c5cc6f900941be8ac3ec21bd1cce53f4b3ae
2015-10-27 22:00:00 +05:30
Hemanth Kapila 3fd7c5ee4f Support for http delete and other methods for CurlHandler
Update CurlHandler to allow sending Http 'delete', 'options' and etc
Add two test cases for delete
Add two test cases for options

Support for other Http methods

Added tests for options as well


Commit migrated from https://github.com/dotnet/corefx/commit/20819227e708d42db9c3c4f8b7c0fd13180da777
2015-10-27 21:15:04 +05:30
David Shulman 7421388e81 WinHttpHandler: Fix POSTs with zero length content
While researching dotnet/corefx#3292, I discovered that POST'ing zero length content throws an exception. This was because we were calling WinHttpWriteData() and passing in a zero length for the buffer size. This returns an error back from WinHTTP.

We don't need to call WinHTTP APIs to write zero length data. We simply need to return a completed task back to the caller.

Added tests to verify the fix.


Commit migrated from https://github.com/dotnet/corefx/commit/0776e741430e83fe72bf4be544701f0eeddce042
2015-10-23 15:19:30 -07:00
stephentoub bc5024849b Fix CurlHandler deadlock with synchronous CopyToAsync
CurlHandler calls to HttpContext.CopyToAsync with a stream that CopyToAsync should write to asynchronously.  If, however, the call to CopyToAsync writes to it synchronously as part of the synchronous call to CopyToAsync, CurlHandler will deadlock.

As a precaution, we ensure that the CopyToAsync call is asynchronous from the perspective of CurlHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/ebad2d3426af24201526263401fb010a78ee60bd
2015-10-23 08:24:18 -04:00
Stephen Toub 544c9f5354 Merge pull request dotnet/corefx#4078 from davidsh/requeststream_hang
Fix hang when writing request stream in WinHttpHandler

Commit migrated from https://github.com/dotnet/corefx/commit/e715350896154fc554f4d995c0c1294d6535ce08
2015-10-23 08:19:58 -04:00
David Shulman e4f15565ba Disable test on Linux
Commit migrated from https://github.com/dotnet/corefx/commit/775f07fac48137520e66b848fc9cf29428ebf07a
2015-10-22 20:13:39 -07:00
David Shulman 779afbe587 Fix hang when writing request stream in WinHttpHandler
WinHttpHandler was hanging due to blocking on the WinHTTP status callback thread. The blocking was coming from a task continuation resuming on the same thread and subsequently calling a blocking Stream.Write method in a custom HttpContent class being written onto the request stream.

Blocking is not allowed on the WinHTTP callback thread. So any task continuations need to occur on a different thread. The fix is to create the TaskCompletionSources to use RunContinuationsAsynchronously. This allows them to unblock the WinHTTP thread. Additionally, I added some missing ConfigureAwait(false) settings to some await'd operations.

Added a new test which uses a custom HttpContent class that uses a blocking Write() call when serializing onto the request stream.

Fix dotnet/corefx#4077


Commit migrated from https://github.com/dotnet/corefx/commit/babb7c6c65bf1e02dab667cbda80f0e24af21ed8
2015-10-22 16:44:06 -07:00
Matt Ellis f23deed6ba Merge 'upstream/master' into from-tfs
Conflicts:
	src/Common/test-runtime/project.lock.json
	src/System.Reflection.TypeExtensions/src/project.json
	src/System.Reflection.TypeExtensions/src/project.lock.json


Commit migrated from https://github.com/dotnet/corefx/commit/262aebcb35b4e0b09b1e08d37cdd70de3fb092e8
2015-10-22 13:15:56 -07:00
Hemanth Kapila 9bdfc50043 Test case for default state of HttpClientHandler.CookieContainer
Adding a new test case that verifies that httpClient does not send any cookie unless set


Commit migrated from https://github.com/dotnet/corefx/commit/7550e8bdd3af85f322fd309f412f919a6cd4f150
2015-10-22 20:22:19 +05:30
Hemanth Kapila bd0fcddf38 CurlHandler sending empty cookie
CurlHandler is sending an empty cookie unnecessarily. This commit fixes the behavior


Commit migrated from https://github.com/dotnet/corefx/commit/abc20ae4735e54c076e34795827af02ec7c9ce74
2015-10-22 11:27:54 +05:30
Eric St. John 8cc3c24b51 Update lock files that were missed in previous restore.
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
2015-10-21 18:59:09 -07:00
Eric St. John 543808303a Update dnx to v1.0.0-rc1-15838, update dotnet projects to generations
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
2015-10-21 17:03:48 -07:00
stephentoub 9418b556de Make HttpContentAsyncStream readable only internally
An instance of HttpContentAsyncStream is passed to HttpContent.CopyToAsync.  Currently HttpContentAsyncStream is both readable and writable, but reading is only meant for internal usage by CurlHandler's libcurl callbacks.  This change codifies that, such that CanRead now returns false and the public Read* methods throw NotSupportedException.  Internal reading is done via ReadAsyncInternal.


Commit migrated from https://github.com/dotnet/corefx/commit/c0fbe3c8e4d50bbf57acd330de8eac136d59c013
2015-10-20 15:50:44 -04:00
stephentoub 5f67919b29 Implement HttpContentAsyncStream.Write
WCF ends up trying to use Write as part of HttpContent.CopyToAsync implementations.  While that should be addressed separately to use WriteAsync, it's possible others are also using Write instead of WriteAsync, and today we throw NotSupportedException from Write.  So as to let this at least work, I'm implementing Write to delegate to WriteAsync.

I also noticed we were missing a FlushAsync implementation, so I've added one.


Commit migrated from https://github.com/dotnet/corefx/commit/b1bc8d48484f4104d0ec2c440544620b920b605f
2015-10-20 15:41:38 -04:00
bartonjs a768025131 Update all project.lock.json files
Built Windows_NT, Linux, OSX with /p:LockDependencies=true.

CoreFX beta-* => 23419
xunit.netcore.extensions => 00107


Commit migrated from https://github.com/dotnet/corefx/commit/a14b22705df253508bd5f2dab0407bd2c7e4d639
2015-10-19 16:00:44 -07:00
Eric St. John 8cd3109d56 Switch from using "dotnet" to using "dotnet<generation>"
All projects that previously used dotnet have been updated to specify the appropriate generation of the surface area they depend on or in the case of desktop inbox contracts, the generation that includes the set of platforms they can support.

Now all packages contain all generations of API that they have ever shipped.

In doing this I needed to change how we determine package version.  Before we ensured all assemblies would have the same version and used that.  Now we choose the max.

Additionally I needed to change how we chose which asset to use for netcore50 when the dotnet asset was obscured by a placeholder for a previous netcore release (eg System.Runtime will have placeholders for Win8 since it was inbox there).  To do this I wrote a task that uses nuget to evaluate the package assets with and without the placeholders.  In this way it chooses the "best" dotnet implementation and reference assembly to use for netcore50.

This new model made my old MSBuild-based validation impossible to carry forward, so I wrote better validation in a task that actually uses Nuget's asset resolution algorithm.  This uncovered many existing issues in packages that I have cleaned up.  The validation algorithm could use some polish but its working now.  Perf is not great, package build went from 15s to ~2 minutes.  I'll work on this some more by making it incremental (input: nuspec, output: marker created on success).  Profiling shows that most of the time is spent in calling the nuget APIs.  I'll see if I can reduce some of this with caching for things that don't change (eg: RID graph).  Ultimately I think its a reasonable tradeoff for the types of bugs I can find this way.

[tfs-changeset: 1539216]


Commit migrated from https://github.com/dotnet/corefx/commit/0931c347eb836c9da94d0d5ff9ad7a14403b9738
2015-10-18 21:12:23 -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
Stephen Toub 88310b6bc9 Merge pull request dotnet/corefx#3806 from kapilash/rewindable
PreAuthenticate fix

Commit migrated from https://github.com/dotnet/corefx/commit/625b9bd2dcb8809455cddaf0c882d87bdfcc682c
2015-10-14 12:48:15 -04:00
Hemanth Kapila 3b56433cf5 PreAuthenticate fix for CurlHandler
When CURLOPT_HTTPAUTH is set to 'any', libcurl will always try to make more than one call to figure out the
right authentication scheme needed by the server. This breaks the behavior when PreAuthenticate is set to true.
The fix is to iterate over available schemes and set the auth-scheme flags to only those that are available.
Also, while updating the CredentialCache, we ignore ArgumentException (raised when the cache contains the given url and scheme pair)
Throw exception when network credentials are different for auth schemes


Commit migrated from https://github.com/dotnet/corefx/commit/17fdc686de07b9f9711956eea25e6c0c9042cd17
2015-10-14 14:45:43 +05:30
David Shulman 02c17e7794 Re-enable test of *Nix
HttpContentTest.ReadAsStringAsync_SetInvalidCharset_ThrowsInvalidOperationException
can be re-enabled due to fixes in the CoreCLR for System.Text.Encoding on
*Nix.  This fixes dotnet/corefx#3343.


Commit migrated from https://github.com/dotnet/corefx/commit/58b40540cf56a43469ccb1cee1323cfc392aa4aa
2015-10-13 18:40:08 -07:00
stephentoub 0f3bc08cf0 Address PR feedback
- Ensure CurlException in addition to IOException is wrapped in an HttpRequestException
- Consolidate such wrapping to one place
- Update a comment
- Check for already disposed in Dispose


Commit migrated from https://github.com/dotnet/corefx/commit/349edc9f77c2aedb36f54a0e971219a733a27c64
2015-10-12 15:57:14 -04:00
stephentoub 74361348bc Improve perf for synchronous CopyToAsync
It's common for the HttpContent to synchronously give back a Task from CopyToAsync and for CopyToAsync have synchronously initiated a WriteAsync.  In such cases, the previous commits would have made that asynchronous by scheduling it in a Task, which means that it's more likely a subsequent ReadAsync from a libcurl callback would end up having the ReadAsync complete asynchronously, which is expensive due to the pausing infrastructure.

This change removes the asynchronous scheduling of CopyToAsync, making it more likely that synchronously available data will be available by the first ReadAsync call.


Commit migrated from https://github.com/dotnet/corefx/commit/52aace9364de641030affa8c1c6a5d24526a65ae
2015-10-12 15:48:01 -04:00
stephentoub 7e62766fa3 Fix CurlHandler to only wrap IOExceptions
When a failure occurs, we're currently wrapping all exception types except for HttpRequestException.  To match the desktop and WinHttpHandler behavior, we should only be wrapping IOExceptions.


Commit migrated from https://github.com/dotnet/corefx/commit/993e5f482a6ebbf9c1a19092dd9b93d70008f812
2015-10-12 15:48:00 -04:00
stephentoub eab8ad6e54 Update CurlHandler to use HttpContent.CopyToAsync
To get a request content stream, CurlHandler currently uses the
HttpContent's ReadAsStreamAsync, and when libcurl needs to rewind the
stream, CurlHandler seeks on the stream.

Unfortunately, it turns out ReadAsStreamAsync isn't actually intended to
be used by handlers in this manner, and as such there are some
deficiencies that lead to correctness problems.  For example, some of the
WCF HttpContent-derived types return non-seekable streams from
CreateContentReadStreamAsync and thus from ReadAsStreamAsync.  This means
that, using ReadAsStreamAsync, if we need to resend a request, we need to
call ReadAsStreamAsync again. But ReadAsStreamAsync doesn't do the same
_contentConsumed check that SerializeToStreamAsync does. That means if the
content is actually a StreamContent, whose CreateContentReadStreamAsync
just does ```return Task.FromResult(new
ReadOnlyStream(this._content));```, and if the stream is non-seekable,
then we'll end up getting back the "new" stream but that's already had its
content consumed, and we won't know. We can't even try to do an object
reference comparison, because StreamContent is wrapping the returned
stream in a new ReadOnlyStream instance each time.  The recommended
approach for handlers is to use HttpContent.CopyToAsync.

CopyToAsync is a push-based model, letting the HttpContent write to a
target stream.  CurlHandler/libcurl have a pull-based model, with
CurlHandler ReadAsync'ing from the request content based on callback from
libcurl.  To straddle this divide, this commit adds a specialized
push/pull adapter stream that let's CurlHandler effectively read from the
pushing source.  If/when libcurl asks to rewind, the stream resets itself
by doing a new CopyToAsync operation.

This revised approach does incur more costs, however care has been taken
to try to minimize those overheads as much as possible, and the change is
necessary for correctness.


Commit migrated from https://github.com/dotnet/corefx/commit/3678490e2d53d9a9fca6c7e50daadd7152b836f7
2015-10-12 15:47:59 -04:00
stephentoub ba9fea449f Reorganize src\Common\tests
Our common tests folder has gotten a bit unwieldy in its organization.  This change simply moves files around to better map to how src\Common\src is organized.  Files are now stored in a path based on functionality/namespace.

I mostly kept groups of functionality together and did not attempt to reorganize at that level, e.g. I moved the src\Common\tests\System.Xml.XPath\ folder to be src\Common\tests\System\Xml\XPath\ and did not further reorganize all of the folders/files it contains.  Such cleanup can be done separately on each individual area.

Some of the files also need to be cleaned up internally, e.g. the namespace (or lack thereof), so I put such things in a path that I thought made sense even if it differs from the current namespace in the file; I wanted this change to be relatively simple and just be about moving files around to clean up the main hierarchy.


Commit migrated from https://github.com/dotnet/corefx/commit/9a5546c439f7700d3462564678aa4206c7fbf4f1
2015-10-11 15:44:39 -04:00
stephentoub 4d0f06a262 Re-enable HttpClient encoding tests on Unix
Commit migrated from https://github.com/dotnet/corefx/commit/6f8fb64d2a994dc120b1ab539d0a2e93030c6663
2015-10-09 16:14:25 -04:00
Stephen Toub a5e18b5444 Merge pull request dotnet/corefx#3720 from stephentoub/fix_curlhandler_scheme_checking
Remove unnecessary scheme check in CurlHandler

Commit migrated from https://github.com/dotnet/corefx/commit/f862cf044c0246635dd5c69e41ec547d32639eb1
2015-10-09 08:10:32 -04:00
David Shulman e45cc6afdf Add test to verify default values for HttpClientHandler
Ported this test to GitHub.

Note that the change in default values between Desktop and CoreFx for two
of the properties is an "intentional, improving, change".


Commit migrated from https://github.com/dotnet/corefx/commit/7aa4a1f71640351230943fa06f51602cb2c07cb3
2015-10-08 15:35:10 -07:00
David Shulman b7b2027a1e Add more HTTP tests
Ported some missing tests to GitHub. Cleaned up some of the existing
tests.


Commit migrated from https://github.com/dotnet/corefx/commit/870810a3a50b41acc088a907dd7a5ea88a214ec8
2015-10-08 14:05:35 -07:00
stephentoub 0f97bdcb18 Remove unnecessary TODO in CurlHandler
This is handled by HttpClient.


Commit migrated from https://github.com/dotnet/corefx/commit/37d4e0f08ee24839be1475a07d236e4a820ad09c
2015-10-08 11:12:17 -04:00
stephentoub 9db961568b Remove unnecessary scheme check in CurlHandler
CurlHandler is explicitly checking to ensure that the request URI scheme is either http or https. HttpClient already does this check before getting to this point, WinHttpHandler doesn't do the duplicative check, and even if a bad scheme sneaks in, our subsequent usage of libcurl will enforce that only http/htps are used. Replacing the check/exception with an assert.


Commit migrated from https://github.com/dotnet/corefx/commit/287baeadf7348f0c671a8bcd07842977935de215
2015-10-08 10:43:18 -04:00
David Shulman d27860b628 Add more tests for System.Net.Http library
Ported more HTTP related tests.  These tests focus mostly on POST
scenarios mixed with authentication, pre-authentication, and the
"rewind-ability" of content if it needs to be re-POST'd due to AUTH
challeges by the server.

Added a new HttpTestServers2 class to Common/tests/System/Net. This is a
point-in-time thing as we improve the test infrastructure capability. In
particular, we are moving away from the use of the "httpbin.org" server.
Our new networking test server that we are bringing up has more features
than httpbin.org. It can support all the main HTTP verbs when doing "echo"
of request headers. It includes a "Content-MD5" HTTP response header. This
contains a hash of the response body. This makes it easier to validate the
returned payloads. The "httpbin.org" server also has a bug where it does
not properly echo chunked upload headers which was causing issues when
trying to port these tests.

I did not change other networking tests still using "httpbin.org" and the
Common HttpTestServers class. I will be doing that later as we finalize
the test infrastructure.


Commit migrated from https://github.com/dotnet/corefx/commit/f14225a7355bdae2468bb3c28562da0a0976f206
2015-10-07 10:49:56 -07:00
Stephen A. Imhoff 9fb3950e79 Remove custom error checking from System.Net.Http, per dotnet/corefx#516
- Use ShouldNotBeInvokedException to explicitly state some callbacks
should not be invoked.


Commit migrated from https://github.com/dotnet/corefx/commit/f333a31abbe1de0feb8a79b348aedb6e21d9c67e
2015-10-03 10:24:55 +09:00
stephentoub 613a87d035 Add explicit 0 index args to Array.Copy usage
Array.Copy is implemented to work with any System.Array, not just T[].  When Array.Copy(sourceArr, destArray, length) is used, it delegates to Copy(sourceArr, sourceIndex, destArray, destIndex, length), and as such needs to query for the lower-bound of the supplied arrays, since although a T[] in C# always has a lower-bound of 0, an arbitrary Array may not.  Given this, when calling Array.Copy, instead of calling Array.Copy(src, dest, length), it's slightly more efficient to just call Array.Copy(src, 0, dest, 0, length), avoiding the need for the GetLowerBound calls made while delegating to the 5-arg version.

I noticed one occurrence of this in some code I was looking at, and while fixing that, I fixed all of them across corefx\src.


Commit migrated from https://github.com/dotnet/corefx/commit/979026e435672e611e3f6e0647c873aa96ccc684
2015-10-02 13:56:48 -04:00
Ian Hays 0f8197a86c Update CoreFX to xunit 2.1.0
Commit migrated from https://github.com/dotnet/corefx/commit/87b48c58936d66fcb201b3a8ad0961fa055f23b9
2015-10-01 19:56:49 -07:00
Hemanth Kapila 4f26738d30 CURL Handler redirect fixes
This commit fixes the following issues  in CurlHandler w.r.t following URI redirection

* Ensure that the credentials are nullified at the right place. We should not set username and/or password to null unnecessarily. libcurl differentiates between unset UserNames/Passwords and null user names/passwords

* Ensure that libcurl follows only HTTPS uri if the original request was for a HTTPS URL.

* Ensure that libcurl follows only a HTTPS or a HTTP uri if the original request was for a HTTP URL.

* Ensure redirect results in a proper response code

* For all requests, limiting protocols to http and https


Commit migrated from https://github.com/dotnet/corefx/commit/7c59e04ce8b26887c386fc3045882196a3142b36
2015-10-01 19:34:28 +05:30