commit
6fe4034e7c
|
@ -149,8 +149,10 @@ function getAceFile(callback) {
|
||||||
var request = require('request');
|
var request = require('request');
|
||||||
|
|
||||||
var baseURI = 'http://localhost:' + settings.port
|
var baseURI = 'http://localhost:' + settings.port
|
||||||
|
var resourceURI = baseURI + path.normalize(path.join('/static/', filename));
|
||||||
|
resourceURI = resourceURI.replace(/\\/g, '/'); // Windows (safe generally?)
|
||||||
|
|
||||||
request(baseURI + path.normalize(path.join('/static/', filename)), function (error, response, body) {
|
request(resourceURI, function (error, response, body) {
|
||||||
if (!error && response.statusCode == 200) {
|
if (!error && response.statusCode == 200) {
|
||||||
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
|
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
|
||||||
+ JSON.stringify(body || '') + ';\n';
|
+ JSON.stringify(body || '') + ';\n';
|
||||||
|
|
|
@ -54,7 +54,7 @@ CachingMiddleware.prototype = new function () {
|
||||||
var modifiedSince = (req.headers['if-modified-since']
|
var modifiedSince = (req.headers['if-modified-since']
|
||||||
&& new Date(req.headers['if-modified-since']));
|
&& new Date(req.headers['if-modified-since']));
|
||||||
var lastModifiedCache = !error && stats.mtime;
|
var lastModifiedCache = !error && stats.mtime;
|
||||||
if (lastModifiedCache) {
|
if (lastModifiedCache && responseCache[cacheKey]) {
|
||||||
req.headers['if-modified-since'] = lastModifiedCache.toUTCString();
|
req.headers['if-modified-since'] = lastModifiedCache.toUTCString();
|
||||||
} else {
|
} else {
|
||||||
delete req.headers['if-modified-since'];
|
delete req.headers['if-modified-since'];
|
||||||
|
@ -83,7 +83,7 @@ CachingMiddleware.prototype = new function () {
|
||||||
&& new Date(res.getHeader('last-modified')));
|
&& new Date(res.getHeader('last-modified')));
|
||||||
|
|
||||||
res.writeHead = old_res.writeHead;
|
res.writeHead = old_res.writeHead;
|
||||||
if (status == 200 || status == 404) {
|
if (status == 200) {
|
||||||
// Update cache
|
// Update cache
|
||||||
var buffer = '';
|
var buffer = '';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue