Reset the chunked read variables before reading the chunk size and
provide a better error in case of a protocol problem.
State GetChunkSize (byte [] buffer, ref int offset, int size)
{
+ chunkRead = 0;
+ chunkSize = 0;
char c = '\0';
while (offset < size) {
c = (char) buffer [offset++];
} catch (Exception) {
ThrowProtocolViolation ("Cannot parse chunk size.");
}
-
+
if (chunkSize == 0) {
trailerState = 2;
return State.Trailer;
ares.AsyncWaitHandle.WaitOne ();
if (my_ares.Error != null)
- throw new HttpListenerException (400, "I/O operation aborted.");
+ throw new HttpListenerException (400, "I/O operation aborted: " + my_ares.Error.Message);
return my_ares.Count;
}