Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Make Expect: 100-continue handling more robust - #24789

Merged
stephentoub merged 1 commit into
dotnet:masterfrom
stephentoub:expectcontinue
Oct 23, 2017
Merged

Make Expect: 100-continue handling more robust#24789
stephentoub merged 1 commit into
dotnet:masterfrom
stephentoub:expectcontinue

Conversation

@stephentoub

Copy link
Copy Markdown
Member

When libcurl sends an Expect: 100-continue header, if it gets back a success error code, it may avoid sending the remaining payload and also may keep the connection open, which can confuse servers that expect to receive the fully promised payload and that don't close the connection when sending a final success status code instead of 100 continue. To mitigate this, we simply change the default ExpectContinue == null behavior to be the equivalent of ExpectContinue == false rather than to be "do whatever the platform decides". This also more closely aligns with WinHttpHandler and ManagedHandler, where effectively the "platform" in those cases decides that the default is disabled.

For ManagedHandler, currently we're mimicking behavior like that libcurl employed and may sometimes not send the full payload but still keep the connection open. Instead, make sure we either always send the full payload or close the connection.

Fixes https://github.com/dotnet/corefx/issues/24435
Fixes https://github.com/dotnet/corefx/issues/24778

cc: @geoffkizer, @Tratcher, @Priya91, @wfurt

When libcurl sends an Expect: 100-continue header, if it gets back a success error code, it may avoid sending the remaining payload and also may keep the connection open, which can confuse servers that expect to receive the fully promised payload and that don't close the connection when sending a final success status code instead of 100 continue.  To mitigate this, we simply change the default ExpectContinue == null behavior to be the equivalent of ExpectContinue == false rather than to be "do whatever the platform decides".  This also more closely aligns with WinHttpHandler and ManagedHandler, where effectively the "platform" in those cases decides that the default is disabled.

For ManagedHandler, currently we're mimicking behavior like that libcurl employed and may sometimes not send the full payload but still keep the connection open.  Instead, make sure we either always send the full payload or close the connection.
@Tratcher

Copy link
Copy Markdown
Member

👍 Much better, thank you.

@stephentoub

Copy link
Copy Markdown
Member Author

@dotnet-bot test Linux x64 Release Build please (https://github.com/dotnet/corefx/issues/24722?)

@stephentoub

Copy link
Copy Markdown
Member Author

@dotnet-bot test Outerloop Windows x64 Debug Build please
@dotnet-bot test Outerloop Linux x64 Debug Build please
@dotnet-bot test Outerloop OSX x64 Debug Build please

@stephentoub
stephentoub merged commit 724ddb8 into dotnet:master Oct 23, 2017
@stephentoub
stephentoub deleted the expectcontinue branch October 23, 2017 16:29
@karelz karelz added this to the 2.1.0 milestone Oct 28, 2017
pjanotti pushed a commit to pjanotti/corefx that referenced this pull request Oct 31, 2017
When libcurl sends an Expect: 100-continue header, if it gets back a success error code, it may avoid sending the remaining payload and also may keep the connection open, which can confuse servers that expect to receive the fully promised payload and that don't close the connection when sending a final success status code instead of 100 continue.  To mitigate this, we simply change the default ExpectContinue == null behavior to be the equivalent of ExpectContinue == false rather than to be "do whatever the platform decides".  This also more closely aligns with WinHttpHandler and ManagedHandler, where effectively the "platform" in those cases decides that the default is disabled.

For ManagedHandler, currently we're mimicking behavior like that libcurl employed and may sometimes not send the full payload but still keep the connection open.  Instead, make sure we either always send the full payload or close the connection.
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
When libcurl sends an Expect: 100-continue header, if it gets back a success error code, it may avoid sending the remaining payload and also may keep the connection open, which can confuse servers that expect to receive the fully promised payload and that don't close the connection when sending a final success status code instead of 100 continue.  To mitigate this, we simply change the default ExpectContinue == null behavior to be the equivalent of ExpectContinue == false rather than to be "do whatever the platform decides".  This also more closely aligns with WinHttpHandler and ManagedHandler, where effectively the "platform" in those cases decides that the default is disabled.

For ManagedHandler, currently we're mimicking behavior like that libcurl employed and may sometimes not send the full payload but still keep the connection open.  Instead, make sure we either always send the full payload or close the connection.

Commit migrated from dotnet/corefx@724ddb8
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

4 participants