aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener/Net/ChunkedInputStream.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-07-01 12:24:26 -0400
committerGitHub <noreply@github.com>2017-07-01 12:24:26 -0400
commitff3713153ad2317e1c196f33ac2cba61b449a00e (patch)
tree84d2e6ed5bcb556a2395603b6403c8e992535e6b /SocketHttpListener/Net/ChunkedInputStream.cs
parentfad71a6c7d12c8b207cdf473c7dd7daafa53c174 (diff)
parent2dcad6b5977f5c5be81b18c42506ed8ad3fb73b6 (diff)
Merge pull request #2739 from MediaBrowser/beta
Beta
Diffstat (limited to 'SocketHttpListener/Net/ChunkedInputStream.cs')
-rw-r--r--SocketHttpListener/Net/ChunkedInputStream.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/SocketHttpListener/Net/ChunkedInputStream.cs b/SocketHttpListener/Net/ChunkedInputStream.cs
index 2e0e1964b..919bd95ea 100644
--- a/SocketHttpListener/Net/ChunkedInputStream.cs
+++ b/SocketHttpListener/Net/ChunkedInputStream.cs
@@ -122,11 +122,19 @@ namespace SocketHttpListener.Net
try
{
int nread = base.EndRead(base_ares);
+ if (nread == 0)
+ {
+ _no_more_data = true;
+ ares._count = rb.InitialCount - rb.Count;
+ ares.Complete();
+ return;
+ }
+
_decoder.Write(ares._buffer, ares._offset, nread);
nread = _decoder.Read(rb.Buffer, rb.Offset, rb.Count);
rb.Offset += nread;
rb.Count -= nread;
- if (rb.Count == 0 || !_decoder.WantMore || nread == 0)
+ if (rb.Count == 0 || !_decoder.WantMore)
{
_no_more_data = !_decoder.WantMore && nread == 0;
ares._count = rb.InitialCount - rb.Count;
@@ -164,7 +172,7 @@ namespace SocketHttpListener.Net
asyncResult.AsyncWaitHandle.WaitOne();
if (ares._error != null)
- throw new HttpListenerException((int)HttpStatusCode.BadRequest, "Bad Request");
+ throw new HttpListenerException((int)HttpStatusCode.BadRequest, "Operation aborted");
return ares._count;
}