comparison Net/HTTP.cs @ 16:fba35b87da32

HTTP: Fix bug in tar file handling (incorrect data length)
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 30 Mar 2013 16:41:14 +0100
parents 7c1808f28e05
children 8df7f4dc5615
comparison
equal deleted inserted replaced
15:7c1808f28e05 16:fba35b87da32
418 case ".ico": ctype = "image/x-icon"; break; 418 case ".ico": ctype = "image/x-icon"; break;
419 } 419 }
420 if (ctype != null) context.SendHeader("Content-Type", ctype); 420 if (ctype != null) context.SendHeader("Content-Type", ctype);
421 Stream response = context.GetResponseStream(); 421 Stream response = context.GetResponseStream();
422 int left = fsizei; 422 int left = fsizei;
423 byte[] buffer = new byte[Math.Min(left, 1024 * 10)];
423 while (left > 0) { 424 while (left > 0) {
424 byte[] buffer = new byte[1024 * 10]; 425 int len = fs.Read(buffer, 0, Math.Min(left, buffer.Length));
425 int len = fs.Read(buffer, 0, buffer.Length);
426 if (len <= 0) break; 426 if (len <= 0) break;
427 left -= len; 427 left -= len;
428 response.Write(buffer, 0, len); 428 response.Write(buffer, 0, len);
429 } 429 }
430 response.Close(); 430 response.Close();