Commit 6aed61a0 authored by NTAuthority's avatar NTAuthority

some fix in http header parsing

parent 7a03d1bb
......@@ -47,12 +47,19 @@ namespace uhttpsharp.Headers
public static async Task<IHttpPost> Create(StreamReader reader, int postContentLength)
{
char[] rawEncoded = new char[postContentLength];
int readBytes = await reader.ReadAsync(rawEncoded, 0, rawEncoded.Length);
byte[] raw = Encoding.UTF8.GetBytes(rawEncoded, 0, readBytes);
int totalRead = 0;
while (totalRead < postContentLength)
{
int readBytes = await reader.ReadAsync(rawEncoded, totalRead, rawEncoded.Length - totalRead);
totalRead += readBytes;
}
byte[] raw = Encoding.UTF8.GetBytes(rawEncoded, 0, totalRead);
return new HttpPost(raw, readBytes);
return new HttpPost(raw, totalRead);
}
private readonly int _readBytes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment