[Pkg-javascript-commits] [node-static] 145/151: Closes #104

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:18:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository node-static.

commit 3327cc59126798b6f8fb3ffa19bfeddb8ef55e57
Author: Pablo Cantero <pablo at pablocantero.com>
Date:   Mon Aug 26 17:25:24 2013 -0300

    Closes #104
---
 lib/node-static.js | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/node-static.js b/lib/node-static.js
index a7cd574..011c458 100644
--- a/lib/node-static.js
+++ b/lib/node-static.js
@@ -197,8 +197,8 @@ Server.prototype.serve = function (req, res, callback) {
  */
 Server.prototype.gzipOk = function(req, contentType) {
     var enable = this.options.gzip;
-    if(enable && 
-        (typeof enable === 'boolean' || 
+    if(enable &&
+        (typeof enable === 'boolean' ||
             (contentType && (enable instanceof RegExp) && enable.test(contentType)))) {
         var acceptEncoding = req.headers['accept-encoding'];
         return acceptEncoding && acceptEncoding.indexOf("gzip") >= 0;
@@ -207,11 +207,11 @@ Server.prototype.gzipOk = function(req, contentType) {
 }
 
 /* Send a gzipped version of the file if the options and the client indicate gzip is enabled and
- * we find a .gz file mathing the static resource requested. 
+ * we find a .gz file mathing the static resource requested.
  */
 Server.prototype.respondGzip = function(pathname, status, contentType, _headers, files, stat, req, res, finish) {
     var that = this;
-    if(files.length == 1 && this.gzipOk(req,contentType)) {
+    if(files.length == 1 && this.gzipOk(req, contentType)) {
         var gzFile = files[0] + ".gz";
         fs.stat(gzFile, function(e, gzStat) {
             if(!e && gzStat.isFile()) {
@@ -250,7 +250,7 @@ Server.prototype.respondNoGzip = function (pathname, status, contentType, _heade
     headers['Last-Modified'] = new(Date)(stat.mtime).toUTCString();
     headers['Content-Type']   = contentType;
     headers['Content-Length'] = stat.size;
-    
+
     for (var k in _headers) { headers[k] = _headers[k] }
 
     // Conditional GET
@@ -261,12 +261,12 @@ Server.prototype.respondNoGzip = function (pathname, status, contentType, _heade
         (!clientMTime || clientMTime >= mtime)) {
         // 304 response should not contain entity headers
         ['Content-Encoding',
-         'Content-Language', 
-         'Content-Length', 
-         'Content-Location', 
-         'Content-MD5', 
-         'Content-Range', 
-         'Content-Type', 
+         'Content-Language',
+         'Content-Length',
+         'Content-Location',
+         'Content-MD5',
+         'Content-Range',
+         'Content-Type',
          'Expires',
          'Last-Modified'].forEach(function(entityHeader) {
             delete headers[entityHeader];
@@ -283,7 +283,7 @@ Server.prototype.respondNoGzip = function (pathname, status, contentType, _heade
 };
 
 Server.prototype.respond = function (pathname, status, _headers, files, stat, req, res, finish) {
-    var contentType = _headers['Content-Type'] || 
+    var contentType = _headers['Content-Type'] ||
                       mime.lookup(files[0]) ||
                       'application/octet-stream';
     if(this.options.gzip) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-static.git



More information about the Pkg-javascript-commits mailing list