Skip to content

Commit

Permalink
NuGet v6.1.7 (Watson.Lite), fix for dead wires, thank you @GitHubProU…
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristn committed Jan 22, 2024
1 parent 26b6c55 commit 2a65c57
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ I'd like to extend a special thanks to those that have helped make Watson Webser
- @notesjor @shdwp @Tutch @GeoffMcGrath @jurkovic-nikola @joreg @Job79 @at1993 @MartyIX
- @pocsuka @orinem @deathbull @binozo @panboy75 @iain-cyborn @gamerhost31 @nhaberl
- @grgouala @sapurtcomputer30 @winkmichael @sqlnew @SaintedPsycho @Return25 @marcussacana
- @samisil @Jump-Suit @ChZhongPengCheng33 @bobaoapae @rodgers-r @john144 @zedle
- @samisil @Jump-Suit @ChZhongPengCheng33 @bobaoapae @rodgers-r @john144 @zedle @GitHubProUser67

## Watson vs Watson.Lite

Expand Down
14 changes: 5 additions & 9 deletions src/WatsonWebserver.Lite/HttpResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,11 @@ private async Task<bool> SendInternalAsync(long contentLength, Stream stream, bo
{
await _Stream.WriteAsync(headers, 0, headers.Length, token).ConfigureAwait(false);
await _Stream.FlushAsync(token).ConfigureAwait(false);
_HeadersSent = true; // We use the flag at our advantage, so we can effectively check for dead wires.
_HeadersSent = true;
}
catch (ObjectDisposedException)
{
/* Always check if the stream is disposed, some clients are picky about this and cut the wire in the middle of a request.
* C# documentation explicitly mention catching the disposed object, as we cannot know in advance if the stream is disposed. */
return false;
}
}

Expand Down Expand Up @@ -621,8 +620,7 @@ private async Task<bool> SendInternalAsync(long contentLength, Stream stream, bo
}
catch (ObjectDisposedException)
{
/* Always check if the stream is disposed, some clients are picky about this and cut the wire in the middle of a request.
* C# documentation explicitly mention catching the disposed object, as we cannot know in advance if the stream is disposed. */
return false;
}
}

Expand All @@ -631,13 +629,11 @@ private async Task<bool> SendInternalAsync(long contentLength, Stream stream, bo
try
{
_Stream.Close();
ResponseSent = true; /* We use the flag at our advantage, so we can effectively check for dead wires, sounds a bit unsafe,
* at this specific place but we can assume the stream was cut if the closing operation didn't complete. */
ResponseSent = true;
}
catch (ObjectDisposedException)
{
/* Always check if the stream is disposed, some clients are picky about this and cut the wire in the middle of a request.
* C# documentation explicitly mention catching the disposed object, as we cannot know in advance if the stream is disposed. */
return false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/WatsonWebserver.Lite/WatsonWebserver.Lite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;net462;net48;net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>6.1.6</Version>
<Version>6.1.7</Version>
<Description>Simple, fast, async C# web server for handling REST requests with SSL support, targeted to .NET Core, .NET Standard, and .NET Framework. Watson.Lite has no dependency on http.sys.</Description>
<Authors>Joel Christner</Authors>
<Company>Joel Christner</Company>
Expand Down

0 comments on commit 2a65c57

Please sign in to comment.