Commit Graph
215 Commits
Author SHA1 Message Date
Pallavi Taneja 95a3b67166 Expose Assembly.GetEntryAssembly and TypeInfo.IsEquivalentTo()
Expose Assembly.GetEntryAssembly and TypeInfo.IsEquivalentTo() in System.Reflection.
Fixes issues dotnet/corefx#4146 , dotnet/corefx#2101


Commit migrated from https://github.com/dotnet/corefx/commit/e28fdbd9dd98810a81207c665fdc4e6b40b24e64
2015-12-21 14:56:26 -08:00
Pallavi Taneja 90c2d27bf1 Update Corefx Repo to depend on newer package versions
Disable failing tests with the tracking active issue


Commit migrated from https://github.com/dotnet/corefx/commit/98fdc29624cd791bba42ec1e0cd5c256f331adfe
2015-12-21 11:48:15 -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
Hemanth Kapila 47ab758145 CurlHandler Fix for request uri during redirect
CurlHandler is fixed to set the Response.RequestMessage.RequestUri to
the redirected uri.


Commit migrated from https://github.com/dotnet/corefx/commit/c6bd6230f268f49c09d04ea2d000eb71c6ecc57f
2015-12-15 20:10:03 +05:30
stephentoub 77c4183d17 Update package validation to rc2-23610
Commit migrated from https://github.com/dotnet/corefx/commit/6f6303f0356be4d2dd4ac117373f1e37f8752248
2015-12-11 10:53:47 -05:00
dagood fbfb82cc8c Change all project.json files to validate. Remove lockfiles from source control and add to gitignore.
A few new references to pick up changes that happened over time.


Commit migrated from https://github.com/dotnet/corefx/commit/0d881222d8c3269157639e2e67056e5a83aad834
2015-12-09 16:25:26 -06:00
David Shulman 5be0d2772f Fix tests to use unknown HTTP version
The default value for HttpRequestMessage.Version is Version(1,1). So, we
need to set something different to test the "unknown" version.


Commit migrated from https://github.com/dotnet/corefx/commit/b921e2493feba902ca4394f77a4406ec20810d8e
2015-12-09 11:35:43 -08:00
David Shulman d8f262defb Support HttpRequestMessage.Version in WinHttpHandler
WinHttpHandler was currently ignoring the `HttpRequestMessage.Version`
property and was always sending out requests using 'HTTP/1.1' which is the
default for winhttp.

This fix now will look at the request message `Version` property and
send out the request using either 1.0 or 1.1.  If neither of these
versions are specified, then the request is sent out using the default
winhttp version (which is currently 1.1 as of Windows 10).

Note: The .NET Framework (Desktop) will throw an exception if neither
1.0 nor 1.1 version is specified.  Currently CoreFx including NETNative,
WinHttpHandler and CurlHandler will simply use a default instead of
throwing. While this is different behavior than Desktop, it is more
desirable in the long run.

There is a separate issue dotnet/corefx#4870 to add HTTP/2.0 support to WinHttpHandler.

Fixes dotnet/corefx#4754


Commit migrated from https://github.com/dotnet/corefx/commit/f48989bbe10dd4b24a9e3b085672c30b5251cda6
2015-12-09 11:13:03 -08:00
Eric Erhardt e1abc6cf8b Move the IO check for EINTR down into the native shims.
This allows for the managed code to be cleaner, and it can easily return SafeHandle objects from P/Invoke methods.
Also, it fixes the problem where some code wasn't looping on Interop.CheckIo, which is a problem when EINTR is returned.

Fix dotnet/corefx#3168


Commit migrated from https://github.com/dotnet/corefx/commit/c0ded7d939c7c8ae702586f57011265686879537
2015-12-08 21:24:30 -06:00
Eric Erhardt 5979598973 Merge pull request dotnet/corefx#4791 from eerhardt/ShimIntPtr
Shims should use intptr_t for file descriptors.

Commit migrated from https://github.com/dotnet/corefx/commit/37fb0e5887d3f9ed1356790b71b78610c0dd3ecb
2015-12-04 18:00:40 -06:00
stephentoub e2b0f00995 Fix pipelining in System.Net.Http on CentOS
My previous change to add HTTP/2 multiplexing broke some System.Net.Http functionality on CentOS, or more specifically when using an old version of libcurl that's in our CentOS 7.1 image.

That version of libcurl is from before HTTP/2 multiplexing was introduced.  When multiplexing was added to libcurl, one of the existing libcurl functions (curl_multi_setopt) was changed such that if you were to pass in the HTTP/2 multiplexing option (which didn't exist at the time), due to the way the method was implemented, you'd end up opting in to HTTP 1.1 pipelining rather than having the option just be ignored.  This is not the desired behavior and ends up breaking behaviors where we issue multiple HTTP 1.1 calls on the same multi handle concurrently.

This fix exposes from the native shim whether we're using a version of libcurl that supports HTTP/2 and that knows about the multiplexing option, and only configures the multi handle for multiplexing in that case.


Commit migrated from https://github.com/dotnet/corefx/commit/6d7793e3c24a779c5dde9e9b9419c2e452c32e6c
2015-12-03 22:35:08 -05:00
Eric Erhardt b2059e364c Respond to PR feedback.
Also, fixing the tests by adding a private default constructor to SafeFileHandle so the runtime interop can create the SafeFileHandle from a P/Invoke.


Commit migrated from https://github.com/dotnet/corefx/commit/13b3ff5610cd1d42121d842929b2580cbaf29f02
2015-12-03 14:57:00 -06:00
Eric Erhardt 2c3e768b15 Shims should use intptr_t for file descriptors.
Changing all file descriptors used in System.Native to use intptr_t instead of int32_t.  This way we can marshal SafeHandles without having to add DangerousAddRef/Release code.

Fix dotnet/corefx#2904.


Commit migrated from https://github.com/dotnet/corefx/commit/8a5cbc165a696b39b8d9bb48554c09473d4ca6bc
2015-12-02 22:30:06 -06:00
Wes Haggard 11d572df6c Merge pull request dotnet/corefx#4780 from dsgouda/libporting
Created .builds files for building libraries 

Commit migrated from https://github.com/dotnet/corefx/commit/8564df2594e2bcca684103584fd42fc9b44bf46e
2015-12-02 16:01:47 -08:00
Deepak Shankargouda f5284f6fcc Created initial set of .builds files
Commit migrated from https://github.com/dotnet/corefx/commit/a20fd22b1e44d13e437c235a957a47a2af52838d
2015-12-02 14:38:03 -08:00
stephentoub 6d3b475032 Enable pipelining for HTTP/2 requests
Commit migrated from https://github.com/dotnet/corefx/commit/131c1c6fbfbac7c530247bb96176a45c9bc224ad
2015-12-02 12:29:50 -05:00
stephentoub cf77b65e40 Address PR feedback and fix a few tests
Commit migrated from https://github.com/dotnet/corefx/commit/3e205589a9e17a5b8ff9a4971e227d5f46c7e4c0
2015-12-01 15:38:35 -05:00
stephentoub 00b66c3db3 Add HTTP/2 support to HttpClient on Unix
The latest versions of libcurl have HTTP/2 support; this commit enables that to be used from HttpClient via setting the request Version.  Setting the Version will now pass along that version preference to libcurl; if it's set to 2.0, libcurl will use HTTP/2 if supported, otherwise it'll fall back to its default (1.1).  As part of this I also fixed CurlHandler to pass along v1.0 and v1.1 so libcurl can respect the developer's explicit wishes.

(Note that the HTTP/2 light-up is only available if libcurl supports it.  libcurl relies on nghttp2, which needs to be installed, and a version of libcurl needs to be used that's built against it.  To test, I built these locally from source.)


Commit migrated from https://github.com/dotnet/corefx/commit/3440aa3cdbd6f82de3746762a08eb796b8b3d90a
2015-12-01 14:38:01 -05:00
Hemanth Kapila 9bb74790f3 Fix CurlHandler to allow empty headers in redirect
libcurl does not pass empty headers in case of a redirect uri. This
results in discrepency between CurlHandler and UnixHandler. To work
around this, we set the request headers again in response to a redirect.


Commit migrated from https://github.com/dotnet/corefx/commit/411f1013b2154715ded08ffa27e50f4160f80d08
2015-11-26 09:39:39 +05:30
Hemanth Kapila e1bc6b18f6 Enable ChannelBinding Test for CurlHandler
Enabling Channel Binding test for curlhandler.


Commit migrated from https://github.com/dotnet/corefx/commit/4bcdb1400b85d2a3d9a0b1bc04e5c08c10f51851
2015-11-23 16:13:38 +05:30
stephentoub dd75517d24 Ensure CurlHandler sends headers with empty values
By default libcurl drops headers with empty values, as it uses an empty value as a sentinel to mean "remove a previously added header with this key name."  If you actually want a header with an event value, it needs to have a semicolon appended to the key name.


Commit migrated from https://github.com/dotnet/corefx/commit/93a9704371ab0b45794f2faa39cefb736c9a71a5
2015-11-19 23:04:29 -05:00
Hemanth Kapila 56a3abf10b Use libcurl+openssl to support TLS client certs
Make curlHandler support Client Certificates when the linked libcurl's
ssl backend is compatible with openssl. CurlHandler is also updated to
support ChannelBindingToken


Commit migrated from https://github.com/dotnet/corefx/commit/d3be6bbe9aee8f748f2688fb7bb00c577ac4b11e
2015-11-19 22:31:20 +05:30
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 a7eea95be5 Replace faulty assert in CurlHandler with proper handling
CurlHandler's support for pausing the connection needs to be resilient against spurious unpausing.  This commit just removes a faulty assert for a condition that is possible and replaces it with proper handling (repausing).


Commit migrated from https://github.com/dotnet/corefx/commit/ce27027eb8924d32b5d75d4c46d36660e98570ee
2015-11-11 12:30:23 -05:00
Eric St. John 65210efd31 Update project.lock.json to latest and lock
Commit migrated from https://github.com/dotnet/corefx/commit/6aeea5eabf2aff3baf15f501cabd156dfc5b3f8f
2015-11-09 22:38:10 -08:00
Eric St. John cddddd29f5 Remove unused dependencies
Commit migrated from https://github.com/dotnet/corefx/commit/78fd45ec74afc507a40df519b4df650ac9bd4c42
2015-11-09 22:37:37 -08:00
David Shulman df05d9fc0f Rename HttpTestServers2.cs to HttpTestServers.cs
Commit migrated from https://github.com/dotnet/corefx/commit/36acb05abd55f62aad0c18bc6ede2cef1c58628e
2015-11-09 11:20:41 -08:00
David Shulman b14cd70e12 Cleanup System.Net.Http tests
* Move more tests to the new test server
* Cleanup 'var' coding patterns
* Remove duplicate tests (*Content clas related) that are already covered with the *Content class tests
* Utiilize the newer test server VerifyUpload endpoint which does 'Content-MD5' verification of transmitted payload to the server
as well as payload from the server
* Add GZip related tests in addition to Deflate compression schemes


Commit migrated from https://github.com/dotnet/corefx/commit/773c8ae1db5aa7e5d695a74fb63968382f8529da
2015-11-09 07:05:24 -08:00
Eric Erhardt e703bc01ff Respond to PR feedback.
Instead of creating 5 safe handles to native code, only allocate a single native handle in EasyRequest. The single native object will hold all the function and user data pointers necessary to invoke the managed callbacks.


Commit migrated from https://github.com/dotnet/corefx/commit/6fa52c6daed5675662140ec23c2e76cd8f64ce5d
2015-11-06 10:25:14 -06:00
Eric Erhardt 30629511ce Add shims for Seek and ReadWrite callbacks in libcurl.
Since libcurl defines callbacks with varying signatures from platform to platform, we need to define a signature for the callbacks that doesn't change. Then we register our own native callbacks, which then converts the parameters from the varying signature to the unchanging signature and invokes the managed callback.


Commit migrated from https://github.com/dotnet/corefx/commit/c874d10c29ae61f7e16f8cea327c1ae14f7568ea
2015-11-06 10:25:09 -06:00
Eric Erhardt 23326060ee Merge pull request dotnet/corefx#4267 from eerhardt/ShimMulti2
Add shims for libcurl multi_* functions.

Commit migrated from https://github.com/dotnet/corefx/commit/16676760efc66253f4148390825b5aca0e1dd557
2015-11-02 11:46:53 -06:00
Eric Erhardt 26a1c9bf83 Respond to PR feedback.
Commit migrated from https://github.com/dotnet/corefx/commit/18248105021cac41ac67f831e36a9b092a2e6869
2015-11-02 10:54:52 -06:00
Eric Erhardt ca320526a4 Remove "libcurl" from Interop.Libraries.
Commit migrated from https://github.com/dotnet/corefx/commit/d7dca1088ecc8b487e4bb02574b2f6b36510d63a
2015-10-30 16:39:38 -05:00
Eric Erhardt 3d4a1d83a4 Add a shim for curl_multi_wait.
Commit migrated from https://github.com/dotnet/corefx/commit/f09762189ce3813017f375a27e29559aba200117
2015-10-30 16:25:25 -05:00
David Shulman e222a9ff11 Merge pull request dotnet/corefx#4255 from davidsh/streaming_fix
WinHttpHandler ResponseStream reads should return back with partial data

Commit migrated from https://github.com/dotnet/corefx/commit/383db8b8a8b5a83e540d7fcb952e0e9b4f2da6c4
2015-10-30 14:08:16 -07:00
Eric Erhardt 938710f93d First round of libcurl Multi shimming.
Commit migrated from https://github.com/dotnet/corefx/commit/c85bae2550b24149b5419b6065ec1ab614a3debb
2015-10-30 13:39:46 -05:00
David Shulman 10763035db WinHttpHandler WinHttpResponseStream reads should return back with partial data
.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).

Fixes dotnet/corefx#1825


Commit migrated from https://github.com/dotnet/corefx/commit/5386014a6b74a8d38010b244f9e9ced96df53b69
2015-10-30 10:39:32 -07:00
Hemanth Kapila 3801aebd66 Handling Invalid http response
CurlHandler to throw HttpRequestException if the HttpResponse message from the server has invalid format


Commit migrated from https://github.com/dotnet/corefx/commit/f95b1ec5d25c9046363bf85373060485f76c70a6
2015-10-30 22:20:30 +05:30
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