Last post Jun 17, 2010 05:08 PM by yysun
Jun 17, 2010 05:08 PM|yysun|LINK
I have a HttpHandler that saves raw input of request body to files.
using (var file = File.Create(fin))
byte buffer = new byte;
while ((bytesRead = context.Request.InputStream.Read(buffer, 0, buffer.Length)) != 0)
file.Write(buffer, 0, bytesRead);
It works fine until the client program decided to send content using transfer-encoding:chuncked for big files. The above code stopped working, because the context.Request.ContentLength is 0, context.Request.InputStream.Lenght is 0 and bytesRead got 0.
Can you please help fine a solution?