change response content lengh when using rawbuffer

master
UbitUmarov 2020-04-23 22:28:27 +01:00
parent 10988fe980
commit 46162e620a
1 changed files with 9 additions and 2 deletions

View File

@ -298,18 +298,25 @@ namespace OSHttpServer
m_context.TimeoutKeepAlive = m_keepAlive * 1000; m_context.TimeoutKeepAlive = m_keepAlive * 1000;
} }
m_headerBytes = GetHeaders();
if (RawBuffer != null) if (RawBuffer != null)
{ {
if (RawBufferStart < 0 || RawBufferStart > RawBuffer.Length) if (RawBufferStart > RawBuffer.Length)
return; return;
if (RawBufferStart < 0)
RawBufferStart = 0;
if (RawBufferLen < 0) if (RawBufferLen < 0)
RawBufferLen = RawBuffer.Length; RawBufferLen = RawBuffer.Length;
if (RawBufferLen + RawBufferStart > RawBuffer.Length) if (RawBufferLen + RawBufferStart > RawBuffer.Length)
RawBufferLen = RawBuffer.Length - RawBufferStart; RawBufferLen = RawBuffer.Length - RawBufferStart;
}
m_headerBytes = GetHeaders();
if (RawBuffer != null)
{
int tlen = m_headerBytes.Length + RawBufferLen; int tlen = m_headerBytes.Length + RawBufferLen;
if(RawBufferLen > 0 && tlen < 16384) if(RawBufferLen > 0 && tlen < 16384)
{ {