Commit Graph
74 Commits
Author SHA1 Message Date
David Shulman 54525a2a94 Fix HttpClientHandler timeouts
Since HttpClientHandler doesn't expose all the timeout used by the
underlying WinHttpHandler, we need to disable those timeouts in favor of
the HttpClient.Timeout property.

Addresses issue dotnet/corefx#2857.


Commit migrated from https://github.com/dotnet/corefx/commit/86e89f73a1e7bf5b4fd40878f4fec4741a8651ca
2015-08-26 10:15:34 -07:00
Justin Van Patten 0d0c85067b Avoid unnecessary byte[] allocations in HttpContent
HttpContent.ReadAsStringAsync() has a bunch of calls to
Encoding.GetPreamble() as part of its encoding detection.
GetPreamble() creates a new byte[] each time it is called.
These byte[] allocations can be avoided. Also, as part of this,
cleaned up and improved the performance of the encoding detection.


Commit migrated from https://github.com/dotnet/corefx/commit/de05c8642746842f61cb063c3d43976f7ee00540
2015-08-25 01:04:38 -07:00
David Shulman 33efd55100 Merge pull request dotnet/corefx#2467 from justinvp/http_objectcollection
Avoid internal enumerator allocations in HttpClient

Commit migrated from https://github.com/dotnet/corefx/commit/7b2ed730d8326866a5649b94332c7edd8886cc61
2015-08-24 13:41:17 -07:00
David Shulman 1d920aad29 Merge pull request dotnet/corefx#2561 from justinvp/httpmethod
Optimize HttpMethod.GetHashCode()

Commit migrated from https://github.com/dotnet/corefx/commit/e296c69314d06af2bc6f8e8fea711a374cb1deab
2015-08-24 10:19:37 -07:00
Vijay Kota 7541da1388 HttpClient xplat: Fix bugs in polling and callback logic
- On OSX, the read end of the pipe sometimes wakes up the poll
  with a POLLOUT. Since we are interested in only reading on it,
  scoping down to POLLIN prevents this from happening. Else we
  attempt a read on it which fails

- CheckForCompletedTransfers was being unnecessarily called from the
  socket callback. We are only interested in MSG_DONE after the socket
  callback indicates removal. This will anyway wake up PollFunction which
  calls CheckForCompletedTransfers. This race is also causing a seg fault
  sometimes because curl_multi_socket_action has been called on an fd
  that was getting cleaned up via curl_easy_cleanup (call sequence is
  CurlSocketCallback --> CheckForCompletedTransfers --> EndRequest)

- Also removed some unnecessary CharSet attributes

cc: @stephentoub @davidsh @CIPop @SidharthNabar @pgavlin


Commit migrated from https://github.com/dotnet/corefx/commit/58178ce07fdf0e478467a77698c58fb6d1b4e866
2015-08-21 14:36:37 +05:30
Rajan Singh 680c39d776 Merge pull request dotnet/corefx#2810 from rajansingh10/myfeature
Moving shared default between winHttp & Unix Handler to a seperate common file

Commit migrated from https://github.com/dotnet/corefx/commit/e2e6dcc236c0c01463a1a43349be14761eabf442
2015-08-21 12:03:44 +05:30
Nick Guerrera e9ec7c9939 Merge pull request dotnet/corefx#2901 from nguerrera/shim-open
Use shims for open, close, unlink, shm_open, shm_unlink 

Commit migrated from https://github.com/dotnet/corefx/commit/b6dda6a964dbdd35ef40b8a285222ec4c7838464
2015-08-20 17:38:56 -07:00
Nick Guerrera 16d140fd57 Use shims for open, close, unlink, shm_open, shm_unlink
Commit migrated from https://github.com/dotnet/corefx/commit/709afe1d4f6b2d5ca75a0565e4c24e16a5254ee7
2015-08-20 15:50:44 -07:00
Stephen Toub 1eb19cf4e1 Merge pull request dotnet/corefx#2903 from rajansingh10/bugfix
Removed DumpHeaders dependency & coded to avoid unnecessary splitting

Commit migrated from https://github.com/dotnet/corefx/commit/29d76d3619397f8a458d2281f92b752ab0daac77
2015-08-20 16:55:33 -04:00
Matt Ellis 498a1839d5 Use OSS System.Net.Http for TFS Builds.
Update the internal System.Net.Http for CoreCLR project to point at the open source version.

[tfs-changeset: 1516875]


Commit migrated from https://github.com/dotnet/corefx/commit/59220586485d8e11ed3f0db23cdc0231e7f338ba
2015-08-20 12:55:58 -07:00
Rajan Singh 1c8cff88c3 Removed DumpHeaders dependency & coded to avoid unnecessary splitting
modified:   System/Net/Http/Unix/CurlHandler.cs


Commit migrated from https://github.com/dotnet/corefx/commit/3b43fdf172980df015d26c5712c5e825a7466d86
2015-08-21 00:19:38 +05:30
Stephen Toub 801539eb8e Merge pull request dotnet/corefx#2840 from shrutigarg/latest
Enabling POST method options

Commit migrated from https://github.com/dotnet/corefx/commit/18ccd5333e9fa19a8227b6dac54f2955a4962b52
2015-08-19 08:03:04 -04:00
Vijay Kota 0a710c583d HttpClient xplat: Fix multiple issues with socket/timer callbacks
In earlier version, a curl_multi_socket_action was performed everytime
the callback was invoked irrespective of whether there was activity on
the socket. This in turn causes more callbacks when libcurl tries to read
the socket but finds no data. This can be made more efficient by waiting
for activity on the socket and informing libcurl accordingly
- Fixed implementation of timer callback using an actual timer and handling
  all possible values of timeout
- Fixed a bug in CheckForCompletedTransfers where a mismatch could occur
  between the easy handle specified in the DONE msg
- Fixed the SEGV which was happening in earlier code due to recursive calls
  to curl_multi_socket_action in the socket callback which was being invoked
  synchronously in curl_multi_socket_action. This was causing a stack overflow
  leading to a segfault


Commit migrated from https://github.com/dotnet/corefx/commit/d52dcd394fc174db629acd771d8529714e4dc4f4
2015-08-19 10:21:25 +05:30
Hemanth Kapila 6c8af281b6 Credential Support in Unix HTTP Handler
This checkin integrates CurlHandler to the credential support of libcurl


Commit migrated from https://github.com/dotnet/corefx/commit/2c32a92fa672f84c9b4d2b8cf42a4543b498de80
2015-08-17 19:16:47 +05:30
Rajan Singh 43f0db204a Fixed build break
Commit migrated from https://github.com/dotnet/corefx/commit/3c576656325611b3a36c8fec777453be438133e7
2015-08-17 17:47:53 +05:30
Shruti Garg ff4acf7cce Enabling POST method options
Commit migrated from https://github.com/dotnet/corefx/commit/bb5e32a99dfd1ee7bf3c471a2b6f4c74528b61a5
2015-08-17 16:54:32 +05:30
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
stephentoub ba8bda425b Merge remote-tracking branch 'upstream/master' into from-tfs
Conflicts:
	src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj
	src/System.Threading.Tasks/tests/project.lock.json


Commit migrated from https://github.com/dotnet/corefx/commit/c99aa51bff90dda680eb24a16998e5c99e29ba94
2015-08-14 22:43:59 -04:00
Eric St. John d7a0ae297b Update corefx packages to latest
Commit migrated from https://github.com/dotnet/corefx/commit/23f0b695bd162e0f665427c95180dc21931e5c70
2015-08-14 15:43:23 -07:00
Eric St. John 24877d3ce7 Move System.Net tests up to latest pre-release version
This change undoes the workaround from https://github.com/dotnet/corefx/commit/dotnet/corefx@5d9f9d4c6ea450366c7b70af6e6006a401284d14#diff-53766f09e26c8b4b422d2946d05c83a6


Commit migrated from https://github.com/dotnet/corefx/commit/ccdf7bb4a2a87de13f8dba69ac7a0df3818c69b1
2015-08-14 10:21:53 -07:00
Hemanth Kapila 643c412a2a PR Comments
Following PR comments were addressed:
*. curl_version_info_data is defined till the required field
*. the fields were made readonly.


Commit migrated from https://github.com/dotnet/corefx/commit/8f52c16490967b7906800a46bdea546cbfb526e8
2015-08-14 21:40:42 +05:30
Hemanth Kapila 91e60241d2 Introducing checks for libcurl features
Runtime and load-time checks to ensure that the features user is relying
on are available in the libcurl library loaded


Commit migrated from https://github.com/dotnet/corefx/commit/20eea4848cac8d8075eacef6dec12b750ca790d2
2015-08-14 16:52:09 +05:30
Eric St. John 77309d4821 Update the version of all assemblies
This change updates the assembly versions of all of the corefx assemblies
as needed after we shipped stable versions.  Assemblies with API differences
get a minor version bump.  Assemblies with only bugfixes get a build version
bump.

In order to facilitate this I had to update the reference assemblies, so I took
the opportunity to port them all to the open.

[tfs-changeset: 1514419]


Commit migrated from https://github.com/dotnet/corefx/commit/40723b795917f2e98b64d45c17effb2546dd0cae
2015-08-13 17:07:57 -07:00
Rajan Singh e80304b9a3 Enabled max redirection in HTTP xplat
modified:   ../../Common/src/Interop/Unix/libcurl/Interop.libcurl_types.cs
	modified:   System/Net/Http/Unix/CurlHandler.cs
	modified:   System/Net/Http/Unix/HttpClientHandler.Unix.cs


Commit migrated from https://github.com/dotnet/corefx/commit/868da12eee3983ad1fdf2031a99e68652b81addb
2015-08-13 21:45:28 +05:30
Rajan Singh 57f897f9e9 Incorporated comments
modified:   System/Net/Http/Unix/CurlHandler.cs
	modified:   System/Net/Http/Unix/HttpClientHandler.Unix.cs


Commit migrated from https://github.com/dotnet/corefx/commit/b2de38156bdd23e6cc3c3e5e40a30cac674475ca
2015-08-13 09:43:54 +05:30
Rajan Singh 81d1b7c09e Enabling cookie container in HTTP xplat
modified:   ../../Common/src/Interop/Unix/libcurl/Interop.libcurl_types.cs
	modified:   System/Net/Http/Unix/CurlHandler.cs
	modified:   System/Net/Http/Unix/HttpClientHandler.Unix.cs


Commit migrated from https://github.com/dotnet/corefx/commit/f79c1cd2a4c646b0434782c64f6de3a686b0bf38
2015-08-12 23:16:08 +05:30
Guillermo Rangel ff81931a13 Fixing CancellationToken not propagating properly and adding some Tests to verify it.
Addressing Feedback in GitHub

Renaming TestHandler to SendAsyncWinHttpMockHandler and adding missing spaces.

Added missing line in json file to use System.Runtime.InteropServices.RuntimeInformation.


Commit migrated from https://github.com/dotnet/corefx/commit/e76774df88b497107e8289fce314ea149abc7811
2015-08-11 13:58:39 -07:00
Vijay Kota b05f4378f9 HttpClient xplat: Add chunked mode support
Commit migrated from https://github.com/dotnet/corefx/commit/d3a3da65c8caf151adfd6db242676b0d6f275f35
2015-08-11 10:23:41 +05:30
Rajan Singh 0b27d483a6 Incorporated comments
modified:   System/Net/Http/Unix/CurlCallbacks.cs


Commit migrated from https://github.com/dotnet/corefx/commit/adfcc89dc3e4b59b0a615cfee3672ad5631751e3
2015-08-11 09:23:05 +05:30
Rajan Singh b29c787740 Incorporated Comments
modified:   System/Net/Http/Unix/CurlCallbacks.cs


Commit migrated from https://github.com/dotnet/corefx/commit/71bf1693fad49b2094a62d3afd69303977d4b977
2015-08-10 22:56:32 +05:30
Rajan Singh e24b5c3205 Fixing multi response header issue along with putting checks in http message parser
modified:   System/Net/Http/Unix/CurlCallbacks.cs


Commit migrated from https://github.com/dotnet/corefx/commit/1c126349c7614823131e09bc0cf78d7e5031865a
2015-08-10 17:12:07 +05:30
Vijay Kota 93bf847b92 HttpClient xplat: Basic request and response processing
- Also addressed some of the comments in https://github.com/dotnet/corefx/issues/2555


Commit migrated from https://github.com/dotnet/corefx/commit/3c24f2ce60a425e10ee903b7d252654dc399a175
2015-08-10 09:57:53 +05:30
Stephen Toub 7cbc620960 Merge pull request dotnet/corefx#2676 from dotnet-bot/from-tfs
Merge changes from TFS

Commit migrated from https://github.com/dotnet/corefx/commit/bd93302de81126297995adcd8b9cc16f82046ce9
2015-08-07 07:38:11 -04:00
David Shulman 7ccf0c26e2 Bug 1188675:Project N Bug: .NET HttpClient can't do Authenticated POSTs due to limitations of System.IO.NetFxToWinRtStreamAdapter
This bug revolves around a design limitations of the System.Runtime.WindowsRuntime System.IO.NetFxToWinRtStreamAdapter. Due to the way that the adapter works, the Windows.Web.Http layer is unable to "rewind" data in order to re-send it to the server for POST requests. Resending request entity-body data to the server is frequently needed due to authentication challenges.

The nature of this bug has resulted in a few common scenarios being broken for UWP (Windows 10 Store) apps that use System.Net.HttpClient or System.Net.HttpWebRequest. Even for simple content like StringContent (which is already buffered and not a stream, per se), we are unable to POST the data since the code paths were always using the limited NetFxToWinRtStreamAdapter.

The fix for this bug is multi-layered. In general, we try to avoid using the NetFxToWinRtStreamAdapter for the POST scenarios. For content that is ByteArrayContent (or derived classes), the data is already "buffered". So, we don't need to send it as a stream. We also check if the data has been buffered via the developer calling LoadIntoBufferAsync() explicitly and send it as a buffer. Then, if the data is not buffered, we check the stream itself. If it already supports the WinRT Stream interfaces, then we don't need to use the adapter. So, third-party devs can create compatible, multi-interface (.NET and WinRT) stream content to be POSTed.

[tfs-changeset: 1511754]


Commit migrated from https://github.com/dotnet/corefx/commit/e298b31e1da3dea3c3fd78f5f713b4659136484e
2015-08-06 20:53:35 -07:00
Hemanth Kapila 442793b080 Automatic Content Decompression
Modified CurlHandler to set the curl options for automatic content
decompression.


Commit migrated from https://github.com/dotnet/corefx/commit/18aec3452bb7b6dea2190151f4f9a26fb7876401
2015-08-07 08:52:32 +05:30
Vijay Kota 46aeb59c0e Fix HTTPS checks in xplat HttpClient
Commit migrated from https://github.com/dotnet/corefx/commit/6a05a612275e9a2fef2aaba5e153c3604077b573
2015-08-05 10:03:08 +05:30
Eric Mellino fd362c6941 Merge pull request dotnet/corefx#2609 from mellinoe/latest-xunit
Latest xUnit beta for all test projects

Commit migrated from https://github.com/dotnet/corefx/commit/4cda5aa5425a2d67e7ee498faf4cc7af480800e0
2015-08-04 14:41:44 -07:00
Stephen Toub 04031c4972 Merge pull request dotnet/corefx#2557 from kapilash/proxy
HttpClient via libcurl : proxy support

Commit migrated from https://github.com/dotnet/corefx/commit/fe4f468789621b3646c5280ab514b4426beca313
2015-08-04 09:53:05 -04:00
Hemanth Kapila c046538a09 HttpClient via libcurl : proxy support
This commit introduces integrates CURL handler with the proxy
functionality offered by libcurl


Commit migrated from https://github.com/dotnet/corefx/commit/71efecc937c9d44c7ea2fa79f21f416575ba6168
2015-08-04 09:06:32 +05:30
Eric Mellino 66969e748b Re-lock dependencies with latest xunit
Commit migrated from https://github.com/dotnet/corefx/commit/795cbc75f8e167047a7c19cd7e21e99b9b9f4308
2015-08-03 16:40:33 -07:00
Eric Mellino 219af47e0c Update test dependencies
Fixes all test warnings about 'different versions of the same dependent
assembly'


Commit migrated from https://github.com/dotnet/corefx/commit/b84f53f744ba0418255cbe471b783dde2a700a8e
2015-08-03 13:44:34 -07:00
Eric Mellino c0015fc582 Move all tests to latest xunit beta
Commit migrated from https://github.com/dotnet/corefx/commit/7c12b0120834f92d5c591124f692ea1b64c6a877
2015-08-03 11:27:48 -07:00
ericstj a419b9c68f Move System.Net tests back to pre-release versions temporarily to fix missing SecureString
The stable versioned packages use an older codebase currently than the latest pre-release.
That codebase is still using SecureString in System.Private.Networking, but the dependency
was omitted since crypto is still pre-release but networking had to be marked stable for UWP.
This missing dependency was causing tests to fail.

Rather than just list the dependency I am moving these tests back to pre-release packages
for the System.Net contracts, since System.Net packages are under active development
it is better to have the tests running against latest than the stable bits.

Once we have newer versions published we'll update these tests to use those.


Commit migrated from https://github.com/dotnet/corefx/commit/5d9f9d4c6ea450366c7b70af6e6006a401284d14
2015-08-02 09:49:36 -07:00
Eric St. John 47aaf9fcf8 Use stable package dependencies and move our packages to post-stable versions
This change modifies the build to consume the stable version where available.

This disables building the dowlevel packages since we shipped them once as stable and we're done.
From here on out, we'll only build the latest version (except for a servicing event, which would
be handled by syncing to a hash).

I can't rev the package versions in the normal way yet (by modifying the assembly version of the contents)
because that turned out to be too big of a problem to tackle in this change. Instead I added a
parameter to the task that calculates package versions to do the rev for anything that was
stable, but only when building the package itself, not when calculating the dependencies.
This has the downside of not permitting a dependency on a incremented pre-release version if we've
shipped a stable version, but that is a small point in time problem until I can rev the assembly
versions.

[tfs-changeset: 1508664]


Commit migrated from https://github.com/dotnet/corefx/commit/ee1ec2891c7c65b46fa9dfb078636be503bb2a60
2015-07-31 15:47:51 -07:00
Justin Van Patten 559f62580d Optimize HttpMethod.GetHashCode()
- Avoid unnecessary allocations associated with the use of
ToUpperInvariant().
- Update tests to be more explicit about the ToUpperInvariant()
behavior.
- Minor cleanup (readonly field, remove unused usings & trailing
whitespace).


Commit migrated from https://github.com/dotnet/corefx/commit/a75896bd169b6481543d1a99d9d110a1c0339987
2015-07-30 16:26:00 -07:00
David Shulman e2fd9f8a40 Merge pull request dotnet/corefx#2553 from davidsh/httpmethod_regression
Fix regression in HttpMethod.GetHashCode()

Commit migrated from https://github.com/dotnet/corefx/commit/50ba7141c650bdd52ce33e8b497519e6129466bb
2015-07-29 13:32:15 -07:00
David Shulman 7088d15fec Fix regression in HttpMethod.GetHashCode()
A PR from last month changed how GetHashCode() works.  This ended up
breaking tests against the .NET Native build of System.Net.Http which
shares the same source code as CoreFx.   So, reverting the change in
GetHashCode() and porting additional ToF tests to GitHub.


Commit migrated from https://github.com/dotnet/corefx/commit/2dcf6471f00954b86663f26f5ce45d8c3485017b
2015-07-29 09:40:13 -07:00
Vijay Kota a660b68ac7 Initial xplat work for HttpClient
Commit migrated from https://github.com/dotnet/corefx/commit/ac4bf3eb90bf9255e64031c3d623b3443f349f7f
2015-07-28 10:45:08 +05:30
David Shulman 19301dfcd2 Merge pull request dotnet/corefx#2534 from justinvp/http_streamtostreamcopy
Make StreamToStreamCopy static

Commit migrated from https://github.com/dotnet/corefx/commit/196c8368b08b813bd768785a91e030ecc0be3f4f
2015-07-27 09:59:45 -07:00
Justin Van Patten b9fa8d30e2 Make StreamToStreamCopy static
Avoids the unnecessary allocation in StreamContent's
SerializeToStreamAsync.


Commit migrated from https://github.com/dotnet/corefx/commit/1bb48a7b5f89c6f3da297c3e91441b18da11a184
2015-07-25 13:35:25 -07:00