diff --git a/MTSC/Common/Http/PartialHttpRequest.cs b/MTSC/Common/Http/PartialHttpRequest.cs index f3ff2c5..7d6ba95 100644 --- a/MTSC/Common/Http/PartialHttpRequest.cs +++ b/MTSC/Common/Http/PartialHttpRequest.cs @@ -403,31 +403,20 @@ namespace MTSC.Common.Http } this.HeaderByteCount = (int)ms.Position; - if (this.Headers.ContainsHeader(EntityHeaders.ContentLength)) + this.Body = ms.ReadRemainingBytes(); + if (this.Headers.ContainsHeader(EntityHeaders.ContentLength) is false) { - var remainingBytes = int.Parse(this.Headers[EntityHeaders.ContentLength]); - if (remainingBytes <= ms.Length - ms.Position) - { - this.Body = ms.ReadRemainingBytes(); - } - else - { - return; - } - } - else - { - if (ms.Length - ms.Position > 1) - { - /* - * If the message contains a body, copy it into a different array - * and save it into the HTTP message; - */ - this.Body = ms.ReadRemainingBytes(); - } + + this.Complete = true; + return; + } + + var contentLength = int.Parse(this.Headers[EntityHeaders.ContentLength]); + if (this.Body.Length >= contentLength) + { + this.Complete = true; } - this.Complete = true; return; } private string GetField(byte[] buffer, ref int index) diff --git a/MTSC/MTSC.csproj b/MTSC/MTSC.csproj index 11c99d6..7548dee 100644 --- a/MTSC/MTSC.csproj +++ b/MTSC/MTSC.csproj @@ -10,8 +10,8 @@ Alexandru-Victor Macocian MTSC Modular TCP Server and Client - 5.1.1.0 - 5.1.1.0 + 5.1.2.0 + 5.1.2.0 true AnyCPU;x64 https://github.com/AlexMacocian/MTSC