Permalink
Browse files

0.4.8

  • Loading branch information...
1 parent cfa2c32 commit e8636734c966d5ebd77c1f3c0922e2a8907d82b9 @Michieljoris committed Feb 22, 2014
Showing with 19 additions and 10 deletions.
  1. +6 −3 lib/bb-server.js
  2. +3 −2 lib/cache.js
  3. +8 −3 lib/defaultHandler.js
  4. +1 −1 package.js
  5. +1 −1 package.json
View
@@ -253,9 +253,12 @@ function listen(port, argv) {
out('Cache: '.grey + getOptionString(options.cache));
if (options.cache) {
- out(' stamped', options.cache.stamped.expiresInString);
- out(' prerendered', options.cache.prerender.expiresInString);
- out(' other', options.cache.other.expiresInString);
+ // out(' stamped', options.cache.stamped.expiresInString);
+ // out(' prerendered', options.cache.prerender.expiresInString);
+ // out(' other', options.cache.other.expiresInString);
+ Object.keys(options.cache).forEach(function(c) {
+ out(' ', c, options.cache[c].expiresInString);
+ });
}
if (options.sessions) {out(options.sessions);}
View
@@ -72,8 +72,9 @@ function breakVows(key, err) {
function cache(key, file) {
- key = file.stamp + key;
- console.log(file.path, ': stamp = ' + file.stamp);
+
+ key = (file.stamp ? file.stamp : '') + key + (file.prerender ? '?_escaped_fragment_=' : '');
+ // console.log(file.path, ': stamp = ' + file.stamp);
var vow = VOW.make();
// debug(memCache.stats());
vows[key] = vows[key] || [];
View
@@ -264,10 +264,10 @@ function retrieveAsIs() { //fetch function
//prerender passes the request on to phantomjs, and then promises the data
//washed clean of javascript, and minified and compressed, if desired.
function prerender() { //fetch function
- out('in prerender');
var vow = VOW.make();
//this function is always called from a file object:
var file = this;
+ out('in prerender', file);
var href = options.seoServer ?
Url.resolve(file.href, file.path) :
Url.resolve('http://localhost:' + options.port, file.path);
@@ -280,7 +280,8 @@ function prerender() { //fetch function
file.status = result.headers.status;
// console.log(result.links, result.headers);
return recaster.recast({ srcData: result.html, type: 'html',
- encoding: file.encoding //gzip or deflate
+ encoding: file.encoding, //gzip or deflate
+ srcPath: file.path
});
})
.when(
@@ -306,7 +307,11 @@ function getFile(req, res) {
var prerenderKey = isPrerender(req);
if (prerenderKey) {
out('prerenderkey:', prerenderKey);
- vow.keep({ href: req.url.href, path: prerenderKey, prerender: true, fetch: prerender });
+ vow.keep({ href: req.url.href,
+ path: prerenderKey,
+ prerender: true,
+ encoding: acceptEncoding(req, 'text'),
+ fetch: prerender });
}
else {
var stripped = stripStamp(req.url.pathname);
View
@@ -35,7 +35,7 @@ module.exports = {
// [npm](http://npmjs.org) enforces the X.Y.Z semantic version
// scheme that is described at [http://semver.org/](http://semver.org/)
// and we should follow this versioning for our package.
- "version": "0.4.3",
+ "version": "0.4.7",
// URL to the homepage for this package.
"homepage": "https://github.com/michieljoris/bb-server",
// An array of keywords used to describe this package to search engines,
View
@@ -1,7 +1,7 @@
{
"name": "bb-server",
"description": "A bare bones http server",
- "version": "0.4.6",
+ "version": "0.4.7",
"homepage": "https://github.com/michieljoris/bb-server",
"keywords": [
"server"

0 comments on commit e863673

Please sign in to comment.