@@ -438,6 +438,7 @@ public static void SendFileOverHTTP(HttpListenerResponse response, StorageFile s
438438
439439 response . ContentType = contentType ;
440440 response . ContentLength64 = fileLength ;
441+ response . SendChunked = true ;
441442 // Now loops sending all the data.
442443
443444 byte [ ] buf = new byte [ MaxSizeBuffer ] ;
@@ -448,11 +449,13 @@ public static void SendFileOverHTTP(HttpListenerResponse response, StorageFile s
448449 // Determines amount of data left.
449450 long bytesToRead = fileLength - bytesSent ;
450451 bytesToRead = bytesToRead < MaxSizeBuffer ? bytesToRead : MaxSizeBuffer ;
452+
451453 // Reads the data.
452454 dataReader . ReadBytes ( buf ) ;
455+
453456 // Writes data to browser
454457 response . OutputStream . Write ( buf , 0 , ( int ) bytesToRead ) ;
455- // allow some time to physically send the bits. Can be reduce to 10 or even less if not too much other code running in parallel
458+
456459 // Updates bytes read.
457460 bytesSent += bytesToRead ;
458461 }
@@ -472,7 +475,7 @@ public static void SendFileOverHTTP(HttpListenerResponse response, string fileNa
472475 contentType = contentType == "" ? GetContentTypeFromFileName ( fileName . Substring ( fileName . LastIndexOf ( '.' ) + 1 ) ) : contentType ;
473476 response . ContentType = contentType ;
474477 response . ContentLength64 = content . Length ;
475-
478+ response . SendChunked = true ;
476479 // Now loop to send all the data.
477480
478481 for ( long bytesSent = 0 ; bytesSent < content . Length ; )
0 commit comments