Fix POST ctx.ParseBody(); (Actually fixed it this time)
This commit is contained in:
@@ -17,6 +17,11 @@ internal class SizedStream : Stream
|
||||
this.len=len;
|
||||
}
|
||||
|
||||
public override int ReadByte()
|
||||
{
|
||||
if(pos >= len) return -1;
|
||||
return strm.ReadByte();
|
||||
}
|
||||
public override bool CanRead => strm.CanRead;
|
||||
|
||||
public override bool CanSeek => false;
|
||||
@@ -35,8 +40,10 @@ internal class SizedStream : Stream
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int read=(int)Math.Min(count,len-pos);
|
||||
|
||||
if(read == 0) return 0;
|
||||
|
||||
read=strm.Read(buffer,offset,read);
|
||||
|
||||
pos+=read;
|
||||
|
||||
return read;
|
||||
@@ -219,9 +226,11 @@ internal class SizedStream : Stream
|
||||
{
|
||||
if(long.TryParse(len_Str,out len))
|
||||
{
|
||||
//DajuricSimpleHttpExtensions.Print($"Content-Length: {len}");
|
||||
return new SizedStream(NetworkStream,len);
|
||||
}
|
||||
}
|
||||
//DajuricSimpleHttpExtensions.Print("Returns NetworkStream");
|
||||
return NetworkStream;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user