Commit Graph
915 Commits
Author SHA1 Message Date
Stephen Toub 7aeebdb5b6 Merge pull request dotnet/corefx#13631 from stephentoub/http_allocs
Reduce allocations in HttpClient

Commit migrated from https://github.com/dotnet/corefx/commit/cc734eb7816f0dad03b7073eae357c86d1904d96
2016-11-15 06:43:26 -05:00
Stephen Toub c29c12aecb Fix System.Net.Http.WinHttpHandler build
All of the previous commits were focused on System.Net.Http.  This fixes up the System.Net.Http.WinHttpHandler build to work with the changes.


Commit migrated from https://github.com/dotnet/corefx/commit/035f06ab40dab532080bc5026f7fd92b2c463687
2016-11-14 17:00:02 -05:00
Stephen Toub cdb0e289a5 Reduce allocations in GetString/ByteArray/StreamAsync
GetStreamAsync:
The GetContentAsync<T> helper was only being used for GetStreamAsync, but was taking a delegate as an argument to compute the stream result.  That delegate takes up space in the state machine.  We can instead just eliminate the delegate and make the GetContentAsync<T> method specific to streams, avoiding the delegate entirely.  This reduces the state machine size on 64-bit from 96 to 88 bytes.

GetStringAsync / GetByteArrayAsync:
Both of these were implemented with an async method that took a delegate with which to determine the results.  They also only involved a single await, in which case ContinueWith is cheaper in allocations, and they're simple enough to just use ContinueWith.  So do so.


Commit migrated from https://github.com/dotnet/corefx/commit/b68308b2637e7edad561954b73cc8251850c3910
2016-11-14 16:59:26 -05:00
Stephen Toub 00522f27c8 Reduce size of FinishSendAsync state machine
Currently the same async method handles both the buffered and unbuffered cases, which means even for the unbuffered case, the state machine needs to hold the relevant fields for the buffered case.  This commit makes it more pay for play by splitting it into two methods.  This reduces the size of the unbuffered state machine by 20% (on 64-bit from 120 bytes to 96 bytes).


Commit migrated from https://github.com/dotnet/corefx/commit/d85d630677621f623ed8d1cd9feb207f56bd0e91
2016-11-14 16:59:26 -05:00
Stephen Toub 13f1b6e89c Avoid collection allocations for TransferEncodingChunked and ConnectionClose
Checking these properties to see whether a special value is set forces the underlying collection to be initialized.  We can avoid that, instantiating them only when they're actually needed.


Commit migrated from https://github.com/dotnet/corefx/commit/6b6ac7523ded82cd879659dc2cdb85ca10b16dca
2016-11-14 16:59:26 -05:00
Stephen Toub dacbc6e6fa Remove delegate allocation from HttpContent.Headers
There's no need to allocate a delegate that stores a reference to this... we can just pass in this.


Commit migrated from https://github.com/dotnet/corefx/commit/211c8a119f8bd5abed3a4941ac93e0193ee6bfb2
2016-11-14 16:59:26 -05:00
Stephen Toub 69c44884a9 Remove ReadOnlyStream allocation and shrink response content
Use a custom stream content that doesn't force us to allocate a ReadOnlyStream wrapper, that gives us the CancellationToken-based ctor we need, and that's smaller, without unnecessary fields.


Commit migrated from https://github.com/dotnet/corefx/commit/786e23394e997bd82f0ff9e657f5ea9ac002901c
2016-11-14 16:59:26 -05:00
Stephen Toub c9dbea388d Avoid allocating StringBuilder in HttpHeaders when empty
We can just return an empty string.


Commit migrated from https://github.com/dotnet/corefx/commit/98665281e78eb7880755287d528a3ee4e11a4cc5
2016-11-14 16:59:26 -05:00
Stephen Toub 308bd45f62 Avoid allocation(s) in ReadAsStreamAsync
We were using an async method to store and return the results from CreateContentReadStreamAsync, putting the resulting Stream into a field typed as Stream.  This required having an async method to unwrap the result of of CreateContentReadStreamAsync, which in the best case (when CreateContentReadStreamAsync completes synchronously) would result in just a Task<Stream> allocation, and in the worst case (when CreatecontentReadStreamAsync completes asynchronously) would result in allocations for that async method's machinery.  We can instead just store the Task<Stream> in the field instead of the Stream, and avoid those allocations entirely.  (This also avoids an extra Task allocation each time the same stream is retrieved, though that's not particularly common.)


Commit migrated from https://github.com/dotnet/corefx/commit/7301572be85ddca88f6af2186736b33129cc4ced
2016-11-14 16:59:26 -05:00
Stephen Toub ed1fd29e3a Use ArrayPool to avoid a per-response char[] allocation
We currently allocate a new char[] to hold all of the response headers.  Use ArrayPool instead.


Commit migrated from https://github.com/dotnet/corefx/commit/e3dfaf26f6f75a71916d78b374496704fffdf5a2
2016-11-14 16:59:26 -05:00
Stephen Toub 44c9914f41 Use Stream.CopyToAsync in StreamToStreamCopy
Now that the base Stream.CopyToAsync has been optimized with ArrayPool and that LimitMemoryStream has its own optimized CopyToAsync override, we're better off using those and deleting most of the custom code in StreamToStreamCopy.


Commit migrated from https://github.com/dotnet/corefx/commit/7f3a155ec11a265d5e4cff4a1da46aba0323fd61
2016-11-14 16:58:25 -05:00
Stephen Toub 74ac16201f Override CopyToAsync on LimitMemoryStream
The base MemoryStream's CopyToAsync implementation only provides its optimizations when the concrete type of the stream is MemoryStream and not for derived streams.  This commit adds a similar optimization to to LimitMemoryStream, such that it'll write its whole buffer to the destination in a single write.


Commit migrated from https://github.com/dotnet/corefx/commit/23b4fa71707970c7828af237fcee7ac0407f88be
2016-11-14 16:58:25 -05:00
Stephen Toub 4e4ec69612 Avoid allocating the CancellationTokenSource when not needed
A new CancellationTokenSource is currently always allocated, which then also means that the data structures inside the CTS that are lazily-initialized on first use will end up getting allocated as well for each operation.  But if the supplied user's token isn't cancelable and there's no timeout, we can avoid these allocations.


Commit migrated from https://github.com/dotnet/corefx/commit/b967c767dfec8ab866dfb503b1b79b7892ec6a73
2016-11-14 16:58:25 -05:00
Stephen Toub 70e9d85cda Remove an empty enumerator allocation with HttpHeaders
Commit migrated from https://github.com/dotnet/corefx/commit/82c7d061e60e1d3ce826195006fefe036d9d4d94
2016-11-14 16:58:25 -05:00
Stephen Toub 90d406d447 Strongly-type the static fields on GenericHeaderParser
Commit migrated from https://github.com/dotnet/corefx/commit/898806b33b2a159c6cdfdf51ee5e4c3057a06179
2016-11-14 16:58:25 -05:00
Eric Mellino 1435610de7 Enable ApiCompat in S.R.WinRT by updating WinRT targeting pack
Commit migrated from https://github.com/dotnet/corefx/commit/0af44e88bd4a6ce633a542189f0536f1e6e215b0
2016-11-14 12:31:25 -08:00
dotnet-bot bb01d482d2 Update CoreFx, ProjectNTfs to beta-24714-01, beta-24714-00, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/3342536d369d922f14cc1a9c0fb91b4440a6967e
2016-11-14 15:46:09 +00:00
Wes Haggard e9a1bf21a6 Merge pull request dotnet/corefx#13565 from weshaggard/AddFacades
Add facades

Commit migrated from https://github.com/dotnet/corefx/commit/1f26e27b677e5f256b2cfd4e67acb63661d25a91
2016-11-11 11:54:59 -08:00
Wes Haggard ac2e16bf88 Delete all older individual compat ref/src projects
We are no going to build these in one project instead of individual projects


Commit migrated from https://github.com/dotnet/corefx/commit/d3a2e1a955410d294f39642775c8215aae63a1d0
2016-11-11 09:31:59 -08:00
Eric St. John 8d0ead0175 Fix warnings when building corefx
A couple of these were harbingers of test issues so I cleaned everything
up so that folks can pay attention when they add a warning.


Commit migrated from https://github.com/dotnet/corefx/commit/811ea81d1fad349649e844a76cf0574f6460841d
2016-11-11 09:19:09 -08:00
dotnet-bot a02764567f Update CoreFx to beta-24711-02
Commit migrated from https://github.com/dotnet/corefx/commit/3709a83afb9ffb8aa05b6c6f5561859527226595
2016-11-11 15:52:34 +00:00
dotnet-bot b9b36cbb7a Update CoreFx, External, ProjectNTfs to beta-24711-01, beta-24711-00, beta-24711-00, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/2ab7ba374f98bb0c3785435169d9b568c5f24eba
2016-11-11 06:19:20 +00:00
dotnet-bot d1fb8ddc0f Update CoreFx, External, ProjectNTfs to beta-24710-01, beta-24710-00, beta-24710-00, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/0a2361383fda2720c5eada8c80d24850a9d61246
2016-11-10 14:31:27 -08:00
Stephen Toub bd16d17031 Merge pull request dotnet/corefx#13527 from stephentoub/curl_defaults
Make HttpClient on Unix treat SslProtocols.None as meaning system defaults

Commit migrated from https://github.com/dotnet/corefx/commit/28e8fdf7fb6717e29206a155abc6d92308ef3663
2016-11-09 20:23:03 -05:00
Jeremy Kuhne f05a8c4187 Move IO types into System.Runtime.Extensions (dotnet/corefx#13451)
Move all of System.IO into System.Runtime.Extensions.
Finish moving System.IO.Primitives into System.Runtime.

Commit migrated from https://github.com/dotnet/corefx/commit/55eb2f16c4ccdb6e4c50a89af5c14ac843239901
2016-11-09 14:44:50 -08:00
Cristian Pop fad54f95d4 Merge pull request dotnet/corefx#13075 from CIPop/tls_pr
TLS SystemDefault support.

Commit migrated from https://github.com/dotnet/corefx/commit/1ae37add7583acebfa21bbc2074ab627a2f765a7
2016-11-09 14:01:31 -08:00
Stephen Toub 4c57b8d7f1 Make HttpClient on Unix treat SslProtocols.None as meaning system defaults
This way, as libcurl and OpenSSL are updated to support newer protocols and disable older ones, we inherit the latest settings.


Commit migrated from https://github.com/dotnet/corefx/commit/79777327b700f6d14fa5c64b072e5a031d6d512b
2016-11-09 14:23:32 -05:00
dotnet-bot c5bd931c2d Update CoreFx to beta-24709-02
Commit migrated from https://github.com/dotnet/corefx/commit/68a1670fc7b9c9419f5d3100ac9a4347874aeef8
2016-11-09 15:38:49 +00:00
dotnet-bot d6f29b0517 Update CoreClr, CoreFx, External, ProjectNTfs to beta-24709-02, beta-24709-01, beta-24709-00, beta-24709-00, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/8a5167a13e1ae72cff71285c49f5f84e10a64248
2016-11-09 09:19:32 +00:00
dotnet-bot c561086403 Update CoreClr, CoreFx to beta-24709-01, beta-24708-05, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/bafbeec4841285834d31bee295c225a61de2b780
2016-11-09 01:10:38 +00:00
Cristian Pop 1fb0a8ece8 TLS SystemDefault support.
Commit migrated from https://github.com/dotnet/corefx/commit/e882577f1cdf1c6505681c0a52a532d78f03c24f
2016-11-08 16:07:26 -08:00
Stephen Toub 27794c3e5c Update corefx to beta-24708-03
Commit migrated from https://github.com/dotnet/corefx/commit/9f9c2885208315215b7e328ea399f13c83d1b8a7
2016-11-08 17:10:15 -05:00
dotnet-bot b740f1d2bd Update CoreClr, CoreFx, External, ProjectNTfs to beta-24708-02, beta-24707-01, beta-24708-00, beta-24708-00, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/b255d0bf4df94eb383c1bb4b42b1bfe9b64f3238
2016-11-08 17:07:45 -05:00
Stephen Toub 7928cb6303 Use std::nothrow with new operator in native shims
To avoid exceptions propagating out of native shims and crashing at interop boundary.


Commit migrated from https://github.com/dotnet/corefx/commit/02dda0a64c651573928fbafe0218f023890442d4
2016-11-06 07:18:09 -05:00
dotnet-bot d63a7b41df Update CoreFx to beta-24705-01
Commit migrated from https://github.com/dotnet/corefx/commit/c7603507fe200426130f10d6b2cc67dfeda2c83f
2016-11-05 02:22:03 +00:00
dotnet-bot 540789c36c Update CoreClr, CoreFx, External, ProjectNTfs to beta-24704-04, beta-24704-03, beta-24704-00, beta-24704-00, respectively
Commit migrated from https://github.com/dotnet/corefx/commit/d75d49704cffb9652304a357750d7f3f357be6fc
2016-11-05 00:21:20 +00:00
Jeremy Kuhne 90d1f3d724 Update to CoreCLR FileStream (dotnet/corefx#13229)
* Json changes for updating to new CLR

* Take new CoreCLR

Uses new copy of FileStream from CoreCLR
Moves FileStream to System.Runtime
Forwards from old locations
Various workarounds/fixes

* Update to CoreCLR beta-24704-03


Commit migrated from https://github.com/dotnet/corefx/commit/bd667b3e719ff84110d9b3c8c087a678337aa5a5
2016-11-04 11:52:01 -07:00
Stephen Toub 4d8438fb1a Merge pull request dotnet/corefx#13316 from joperezr/UpdateCorefxDependencies
Updating corefx versions to beta-24703-01

Commit migrated from https://github.com/dotnet/corefx/commit/23c2758bf8fbecf2e0758b4cc792f3b75d10766b
2016-11-03 15:02:08 -04:00
Jose Perez Rodriguez 2db115c87d Updating corefx versions to beta-24703-01
Commit migrated from https://github.com/dotnet/corefx/commit/39b5977106283eb0017dbc43af7f4d6b195753b1
2016-11-03 10:23:38 -07:00
Stephen Toub 5c80441a2c More aggressively clean up disposable resource in Http tests
Most of these likely don't matter, but some of these can be keeping alive the underlying connections associated with the HttpClient instance, and it's possible that can lead to more resource contention / exhaustion.


Commit migrated from https://github.com/dotnet/corefx/commit/ec47d4e19f3215f75e652e8e5ff61cc4c253c056
2016-11-03 11:18:27 -04:00
Eric Mellino b22982fb03 Merge pull request dotnet/corefx#13233 from mellinoe/fedora-24
Add full support build for test runs on Fedora 24

Commit migrated from https://github.com/dotnet/corefx/commit/31cb259750808d9f2c1e4788f4bf8a2ea1ab3695
2016-11-02 12:10:39 -07:00
Stephen Toub 183b074730 Fix HttpVersion conflicts
Added an HttpVersionInternal to be used by the higher-stack libraries that need things beyond HttpVersion.Version10/Version11 and/or that have builds targeting versioning of System.Net.Primitives that doesn't have the newly exposed HttpVersion.  This can be removed once all of those libraries have all of their builds targeting the updated primitives lib.


Commit migrated from https://github.com/dotnet/corefx/commit/119ae03ddc2ce49511f10b02fb39818aab0aa577
2016-11-01 19:42:30 -04:00
Stephen Toub 4ee10f7b6c Update CoreFx, ProjectNTfs to beta-24701-01, beta-24701-00, respectively (master)
Commit migrated from https://github.com/dotnet/corefx/commit/1b2b88d11c6b0d226481c96b1a88d20bb8cefaf9
2016-11-01 19:42:30 -04:00
Eric Mellino 6a3b8fa4fd Support full test builds on fedora 24
Commit migrated from https://github.com/dotnet/corefx/commit/f3ae1c1cea4709252b48179fd1eed5a18740d8fc
2016-11-01 22:56:10 +00:00
David Shulman 2677ef78c1 Disable tests for clean CI
ServerAsyncAuthenticate_AllClientVsIndividualServerSupportedProtocols_Success

HttpClient_ClientUsesAuxRecord_Ok

Ref: dotnet/corefx#8744, dotnet/corefx#11623


Commit migrated from https://github.com/dotnet/corefx/commit/0bec1523df81351d7b01e4addee5b350a0f454ef
2016-11-01 12:05:37 -07:00
Stephen Toub 66863565c9 Use nameof in more places
We previously made a pass through corefx to use nameof with argument exceptions.  Since then, a lot more code has come into the repo, and not all argument exceptions were converted at the time. We also previously missed a bunch of places where helpers were used to throw the exceptions.  This does another pass through corefx to catch most of the remaining occurrences.


Commit migrated from https://github.com/dotnet/corefx/commit/08609e84ab068d09a6e72b5906bb5282e444ae2e
2016-11-01 09:25:09 -04:00
David Shulman 637fa2d8b0 Disable another test
Ref dotnet/corefx#13188


Commit migrated from https://github.com/dotnet/corefx/commit/804d3aea2539aa1be5b49b94204f070cb134444b
2016-10-31 14:07:51 -07:00
David Shulman b20f48b477 Disable another test
Disable http test, dotnet/corefx#10504.


Commit migrated from https://github.com/dotnet/corefx/commit/974924694891402de972a7e1eb52c3f9bc0f41dd
2016-10-31 11:38:47 -07:00
David Shulman 13c6b6c2e7 Disable tests to unblock CI
Disabling tests for dotnet/corefx#12637 and dotnet/corefx#12778.


Commit migrated from https://github.com/dotnet/corefx/commit/597ef01e84cfb6cc1c4dda25500e07b27c8e144c
2016-10-31 11:26:55 -07:00
Stephen Toub 5f0b53cb3c Update CoreFx to beta-24629-01 (master)
Commit migrated from https://github.com/dotnet/corefx/commit/63a1dbe34233c086f7fc6d28b1fefecfefc822ed
2016-10-29 22:41:56 -04:00