Skip to content
Browse files

Do not use fd in content cache key

  • Loading branch information...
1 parent 8aa6cc3 commit 54eef3a7fa87ae38a4b0bf74c3e7a3ae92855a7a @isaacs committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 st.js
View
6 st.js
@@ -302,11 +302,13 @@ Mount.prototype.autoindex = function (p, req, res) {
Mount.prototype.file = function (p, fd, stat, etag, req, res) {
- var key = fd + ':' + stat.size + ':' + etag
+ var key = stat.size + ':' + etag
+
var mt = mime.lookup(path.extname(p))
if (mt !== 'application/octet-stream') {
res.setHeader('content-type', mt)
}
+
// only use the content cache if it will actually fit there.
if (this.cache.content.has(key)) {
this.cachedFile(p, fd, stat, etag, req, res)
@@ -316,7 +318,7 @@ Mount.prototype.file = function (p, fd, stat, etag, req, res) {
}
Mount.prototype.cachedFile = function (p, fd, stat, etag, req, res) {
- var key = fd + ':' + stat.size + ':' + etag
+ var key = stat.size + ':' + etag
var gz = getGz(p, req)
this.cache.content.get(key, function (er, content) {

0 comments on commit 54eef3a

Please sign in to comment.
Something went wrong with that request. Please try again.