Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementations of new HttpContent sync methods. #38635

Merged
merged 15 commits into from
Jul 10, 2020

Conversation

ManickaP
Copy link
Member

Adds missing overrides of sync SerializeToStream and CreateContentReadStream to other HttpContent implementations in libraries.

Fixes #37477

cc: @jozkee @GrabYourPitchforks @stephentoub @scalablecory

@ghost
Copy link

ghost commented Jun 30, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from 4b27d68 to 8a68107 Compare June 30, 2020 19:03
@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from 8a68107 to 7ff4989 Compare June 30, 2020 19:10
@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from 98a46f2 to 14eae27 Compare July 1, 2020 11:26
@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from ce19b45 to 6e90249 Compare July 1, 2020 12:38
@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from 7de7713 to 5c20f40 Compare July 1, 2020 14:20
@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from 5c20f40 to 4505b53 Compare July 1, 2020 14:23
@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from a52ca4a to bc77fbb Compare July 1, 2020 16:23
@ManickaP
Copy link
Member Author

ManickaP commented Jul 1, 2020

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jozkee jozkee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to JsonContent LGTM.

@ManickaP ManickaP force-pushed the mapichov/37477_sync_http_contents branch from ad11c9a to 6d34cfc Compare July 2, 2020 08:55
@@ -11,6 +11,7 @@ public partial class ByteArrayContent : System.Net.Http.HttpContent
{
public ByteArrayContent(byte[] content) { }
public ByteArrayContent(byte[] content, int offset, int count) { }
protected override System.IO.Stream CreateContentReadStream(System.Threading.CancellationToken cancellationToken) { throw null; }
Copy link
Member Author

@ManickaP ManickaP Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this was not regenerated in #37494

@ManickaP
Copy link
Member Author

ManickaP commented Jul 2, 2020

WinHttpHandler changes reverted, regenerated ref sources, added/enables more tests.

@stephentoub It's ready for re-review.

Copy link
Contributor

@scalablecory scalablecory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm after question re: CreateRequest is addressed.

Comment on lines -190 to +205
using (HttpResponseMessage response = await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead))
using (HttpResponseMessage response = await client.SendAsync(TestAsync, CreateRequest(HttpMethod.Get, uri, remoteServer.HttpVersion), HttpCompletionOption.ResponseHeadersRead))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this accomplishing? Shouldn't the client's DefaultRequestVersion be the same as remoteServer.HttpVersion here? HttpClient does essentially the same thing as this CreateRequest when you call GetAsync.

Copy link
Member Author

@ManickaP ManickaP Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SendAsync|Send ignores HttpClient.DefaultRequestVersion since it accepts fully constructed request. The default initialization of HttpRequestMessage will set it to 1.1. And because we plug in VersionChecker set up with the remote server version, it will blow up for 2.0 servers.

If it's about why Send versus Get, then it's because we weren't testing decompression with sync code paths at all due to using GetAsync (helpers didn't get sync overloads). And we had an error in missing overrides for decompression content 😞 So I changed the tests to use SendAsync|Send instead and now we're testing both, sync and async.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The product changes LGTM. I didn't review the tests.

Copy link
Contributor

@scalablecory scalablecory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ManickaP ManickaP merged commit 149aa1e into dotnet:master Jul 10, 2020
@ManickaP ManickaP deleted the mapichov/37477_sync_http_contents branch July 10, 2020 06:52
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sync implementation to other HttpContent classes in our libs
6 participants