From 8c19eef07a6d679488ee4aa912d913c82a70c8ad Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Sun, 29 Jun 2014 21:42:35 +0800 Subject: [PATCH] fix: We should use the standard http protocol to handler the etag header. --- lib/index.js | 5 +++-- test/socket.io.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6e6d049c89..18e6785089 100644 --- a/lib/index.js +++ b/lib/index.js @@ -265,8 +265,9 @@ Server.prototype.attachServe = function(srv){ */ Server.prototype.serve = function(req, res){ - if (req.headers.etag) { - if (clientVersion == req.headers.etag) { + var etag = req.headers['if-none-match']; + if (etag) { + if (clientVersion == etag) { debug('serve client 304'); res.writeHead(304); res.end(); diff --git a/test/socket.io.js b/test/socket.io.js index 8622134ba9..6de37c68e5 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -161,7 +161,7 @@ describe('socket.io', function(){ io(srv); request(srv) .get('/socket.io/socket.io.js') - .set('ETag', clientVersion) + .set('If-None-Match', clientVersion) .end(function(err, res){ if (err) return done(err); expect(res.statusCode).to.be(304);