@@ -192,7 +192,7 @@ Server.prototype.serve = function (req, res, callback) {
192192/* Check if we should consider sending a gzip version of the file based on the
193193 * file content type and client's Accept-Encoding header value.
194194 */
195- Server . prototype . gzipOk = function ( req , contentType ) {
195+ Server . prototype . gzipOk = function ( req , contentType ) {
196196 var enable = this . options . gzip ;
197197 if ( enable &&
198198 ( typeof enable === 'boolean' ||
@@ -206,20 +206,17 @@ Server.prototype.gzipOk = function(req, contentType) {
206206/* Send a gzipped version of the file if the options and the client indicate gzip is enabled and
207207 * we find a .gz file mathing the static resource requested.
208208 */
209- Server . prototype . respondGzip = function ( pathname , status , contentType , _headers , files , stat , req , res , finish ) {
209+ Server . prototype . respondGzip = function ( pathname , status , contentType , _headers , files , stat , req , res , finish ) {
210210 var that = this ;
211- if ( files . length == 1 && this . gzipOk ( req , contentType ) ) {
211+ if ( files . length == 1 && this . gzipOk ( req , contentType ) ) {
212212 var gzFile = files [ 0 ] + ".gz" ;
213- fs . stat ( gzFile , function ( e , gzStat ) {
214- if ( ! e && gzStat . isFile ( ) ) {
215- //console.log('Serving', gzFile, 'to gzip-capable client instead of', files[0], 'new size is', gzStat.size, 'uncompressed size', stat.size);
213+ fs . stat ( gzFile , function ( e , gzStat ) {
214+ if ( ! e && gzStat . isFile ( ) ) {
216215 var vary = _headers [ 'Vary' ] ;
217- _headers [ 'Vary' ] = ( vary && vary != 'Accept-Encoding' ? vary + ', ' : '' ) + 'Accept-Encoding' ;
216+ _headers [ 'Vary' ] = ( vary && vary != 'Accept-Encoding' ? vary + ', ' : '' ) + 'Accept-Encoding' ;
218217 _headers [ 'Content-Encoding' ] = 'gzip' ;
219218 stat . size = gzStat . size ;
220219 files = [ gzFile ] ;
221- } else {
222- //console.log('gzip file not found or error finding it', gzFile, String(e), stat.isFile());
223220 }
224221 that . respondNoGzip ( pathname , status , contentType , _headers , files , stat , req , res , finish ) ;
225222 } ) ;
@@ -229,7 +226,7 @@ Server.prototype.respondGzip = function(pathname, status, contentType, _headers,
229226 }
230227}
231228
232- Server . prototype . parseByteRange = function ( req , stat ) {
229+ Server . prototype . parseByteRange = function ( req , stat ) {
233230 var byteRange = {
234231 from : 0 ,
235232 to : 0 ,
@@ -328,12 +325,11 @@ Server.prototype.respondNoGzip = function (pathname, status, contentType, _heade
328325 'Content-Range' ,
329326 'Content-Type' ,
330327 'Expires' ,
331- 'Last-Modified' ] . forEach ( function ( entityHeader ) {
328+ 'Last-Modified' ] . forEach ( function ( entityHeader ) {
332329 delete headers [ entityHeader ] ;
333330 } ) ;
334331 finish ( 304 , headers ) ;
335332 } else {
336-
337333 res . writeHead ( status , headers ) ;
338334
339335 this . stream ( key , files , length , startByte , res , function ( e ) {
0 commit comments