Skip to content

Commit

Permalink
[dotnet] Explicitly remove Expect header
Browse files Browse the repository at this point in the history
When using the HttpClient class, the behavior for an HTTP POST request
is different between .NET Framework and .NET Core. In the .NET Framework
case, the client automatically adds an `Expect: 100-Continue` header.
When the remote end does not send a 100 response, the client hangs
waiting for it. This change explicitly removes that header for all HTTP
requests. Fixes issue #9277.
  • Loading branch information
jimevans committed Oct 7, 2021
1 parent 8e1a3f6 commit 46de1e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private void CreateHttpClient()
this.client = new HttpClient(httpClientHandler);
this.client.DefaultRequestHeaders.UserAgent.ParseAdd(this.UserAgent);
this.client.DefaultRequestHeaders.Accept.ParseAdd(RequestAcceptHeader);
this.client.DefaultRequestHeaders.ExpectContinue = false;
if (!this.IsKeepAliveEnabled)
{
this.client.DefaultRequestHeaders.Connection.ParseAdd("close");
Expand Down

0 comments on commit 46de1e6

Please sign in to comment.