Browse files

Fix issue 35 - Safari hangs randomly on page refresh; Do not send con…

…tent length, type or such if no content is sent
  • Loading branch information...
1 parent c58d8d7 commit 895e62ed042e9aaeeb633c92c3d4cedd975f7bb0 @laurisvan laurisvan committed May 28, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/assetmanager.js
View
13 lib/assetmanager.js
@@ -383,24 +383,25 @@ module.exports = function assetManager (assets) {
}
function serveContent(response) {
var headers = {
- 'Content-Type': mimeType,
- 'Content-Length': response.contentLength,
'Last-Modified': response.modified,
'Date': (new Date).toUTCString(),
'Cache-Control': 'public,max-age=' + 31536000,
'Expires': response.expires || (new Date(new Date().getTime()+63113852000)).toUTCString(),
'Vary': 'Accept-Encoding'
};
- if(response.encoding) {
- headers['Content-Encoding'] = response.encoding
- }
-
if (req.headers['if-modified-since'] &&
Date.parse(req.headers['if-modified-since']) >= Date.parse(response.modified)) {
res.writeHead(304, headers);
res.end();
} else {
+ headers['Content-Type'] = mimeType;
+ headers['Content-Length'] = response.contentLength;
+
+ if(response.encoding) {
+ headers['Content-Encoding'] = response.encoding
+ }
+
res.writeHead(200, headers);
res.end(response.contentBuffer);
}

0 comments on commit 895e62e

Please sign in to comment.