Permalink
Browse files

Use pintura redirect module

  • Loading branch information...
kriszyp committed Nov 7, 2011
1 parent 678af06 commit 50b68d91b405c02a893727ab4184c864cbb3f762
Showing with 1 addition and 35 deletions.
  1. +1 −1 jsgi/redirect-root.js
  2. +0 −34 jsgi/redirect.js
View
@@ -1,4 +1,4 @@
-var redirector = require("./redirect").Redirect("/Page/Example");
+var redirector = require("pintura/jsgi/redirect").Redirect("/Page/Example");
exports.RedirectRoot = function(app){
return function(request){
if(request.pathInfo == "/"){
View
@@ -1,34 +0,0 @@
-try{
- var uri = require("url");
-}catch(e){
- var uri = require("narwhal/lib/uri");
-
-}
-
-exports.Redirect = function (path, status) {
-
- status = status || 301;
-
- return function (request) {
- var location =
- (request.scheme || "http") +
- "://" +
- (request.headers.host || (
- request.host +
- (request.port == 80 ? "" : ":" + request.port)
- )) +
- (request.scriptName || "") +
- request.pathInfo;
-
- location = path ? uri.resolve(location, path) : request.headers.referer;
-
- return {
- status: status,
- headers: {
- "location": location,
- "content-type": "text/plain"
- },
- body: ['Go to <a href="' + location + '">' + location + "</a>"]
- }
- }
-}

0 comments on commit 50b68d9

Please sign in to comment.