Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgrade for node 0.1.30-pre

  • Loading branch information...
commit 4c2709c6ce6f59428e587a13986f52ac8e181828 1 parent eb15bed
@ry ry authored
Showing with 14 additions and 16 deletions.
  1. +14 −16 fu.js
View
30 fu.js
@@ -70,22 +70,20 @@ fu.staticHandler = function (filename) {
}
sys.puts("loading " + filename + "...");
- var promise = readFile(filename, encoding);
-
- promise.addCallback(function (data) {
- body = data;
- headers = [ [ "Content-Type" , content_type ]
- , [ "Content-Length" , body.length ]
- ];
- if (!DEBUG)
- headers.push(["Cache-Control", "public"]);
-
- sys.puts("static file " + filename + " loaded");
- callback();
- });
-
- promise.addErrback(function () {
- sys.puts("Error loading " + filename);
+ readFile(filename, encoding, function (err, data) {
+ if (err) {
+ sys.puts("Error loading " + filename);
+ } else {
+ body = data;
+ headers = [ [ "Content-Type" , content_type ]
+ , [ "Content-Length" , body.length ]
+ ];
+ if (!DEBUG)
+ headers.push(["Cache-Control", "public"]);
+
+ sys.puts("static file " + filename + " loaded");
+ callback();
+ }
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.