Skip to content

Conversation

@russcam
Copy link
Contributor

@russcam russcam commented Jul 5, 2019

This commit changes the HttpConnection to not set Content on HttpRequestMessage when there is no PostData. The check is performed inside of Request and RequestAsync to avoid creating any content instance and allocations.

Change length to default in TryComputeLength to match HttpContent implementation.

Pass RequestData through to _onStreamAvailable delegates so that HttpCompression, ConnectionSettings and PostData can be accessed on the passed instance.

Fixes #3907

This commit changes the HttpConnection to not set Content on HttpRequestMessage when there is no PostData. The check is performed inside of Request and RequestAsync to avoid creating any content instance and allocations.

Change length to default in TryComputeLength to match HttpContent implementation.

Pass RequestData through to _onStreamAvailable delegates so that HttpCompression, ConnectionSettings and PostData can be accessed on the passed instance.

Fixes #3907
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

I left some comments on changes made that differ from the reference implementations RequestDataContent is based on.

{
// We can't know the length of the content being pushed to the output stream.
length = -1;
length = default;
Copy link
Member

Choose a reason for hiding this comment

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

public override void Close()
{
_serializeToStreamTask.TrySetResult(true);
base.Close();
Copy link
Member

Choose a reason for hiding this comment

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


public override void WriteByte(byte value) => _innerStream.WriteByte(value);

public override void Close() => _innerStream.Close();
Copy link
Member

Choose a reason for hiding this comment

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

[I]
public void NotUsingSocketsHttpHandlerDoesNotCauseException()
{
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
Copy link
Member

Choose a reason for hiding this comment

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

Add comment this is safe to do because IntrusiveOperationCluster runs with max concurrency of 1

Copy link
Contributor

@codebrain codebrain left a comment

Choose a reason for hiding this comment

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

Reviewed via Zoom, approved with changes

@russcam russcam merged commit 90c2bf7 into master Jul 8, 2019
russcam added a commit that referenced this pull request Jul 8, 2019
This commit changes the HttpConnection to not set Content on HttpRequestMessage when there is no PostData. The check is performed inside of Request and RequestAsync to avoid creating any content instance and allocations.

Pass RequestData through to _onStreamAvailable delegates so that HttpCompression, ConnectionSettings and PostData can be accessed on the passed instance.

Fixes #3907

(cherry picked from commit 90c2bf7)
@russcam russcam deleted the fix/3907 branch July 8, 2019 02:09
russcam added a commit that referenced this pull request Jul 18, 2019
This commit changes the HttpConnection to not set Content on HttpRequestMessage when there is no PostData. The check is performed inside of Request and RequestAsync to avoid creating any content instance and allocations.

Pass RequestData through to _onStreamAvailable delegates so that HttpCompression, ConnectionSettings and PostData can be accessed on the passed instance.

Fixes #3907

(cherry picked from commit 90c2bf7)
codebrain pushed a commit that referenced this pull request Jul 19, 2019
This commit changes the HttpConnection to not set Content on HttpRequestMessage when there is no PostData. The check is performed inside of Request and RequestAsync to avoid creating any content instance and allocations.

Pass RequestData through to _onStreamAvailable delegates so that HttpCompression, ConnectionSettings and PostData can be accessed on the passed instance.

Fixes #3907

(cherry picked from commit 90c2bf7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version 7.0.0 not working with os httphandlers

4 participants