|
|
|
@ -79,12 +79,6 @@ namespace SocketHttpListener.Net
|
|
|
|
|
private int _trailerState;
|
|
|
|
|
private List<Chunk> _chunks;
|
|
|
|
|
|
|
|
|
|
public ChunkStream(byte[] buffer, int offset, int size, WebHeaderCollection headers)
|
|
|
|
|
: this(headers)
|
|
|
|
|
{
|
|
|
|
|
Write(buffer, offset, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ChunkStream(WebHeaderCollection headers)
|
|
|
|
|
{
|
|
|
|
|
_headers = headers;
|
|
|
|
@ -102,13 +96,6 @@ namespace SocketHttpListener.Net
|
|
|
|
|
_chunks.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void WriteAndReadBack(byte[] buffer, int offset, int size, ref int read)
|
|
|
|
|
{
|
|
|
|
|
if (offset + read > 0)
|
|
|
|
|
Write(buffer, offset, offset + read);
|
|
|
|
|
read = Read(buffer, offset, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Read(byte[] buffer, int offset, int size)
|
|
|
|
|
{
|
|
|
|
|
return ReadFromChunks(buffer, offset, size);
|
|
|
|
@ -143,6 +130,9 @@ namespace SocketHttpListener.Net
|
|
|
|
|
|
|
|
|
|
public void Write(byte[] buffer, int offset, int size)
|
|
|
|
|
{
|
|
|
|
|
// Note, the logic here only works when offset is 0 here.
|
|
|
|
|
// Otherwise, it would treat "size" as the end offset instead of an actual byte count from offset.
|
|
|
|
|
|
|
|
|
|
if (offset < size)
|
|
|
|
|
InternalWrite(buffer, ref offset, size);
|
|
|
|
|
}
|
|
|
|
|