Skip to content

Commit

Permalink
Updates Connect from v2.9.0 to v2.30.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethormandy committed Sep 17, 2015
1 parent f9965b2 commit 3f2298d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 48 deletions.
54 changes: 28 additions & 26 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,48 @@ var pkg = require('../package.json')
/**
* Server
*
* Host a single Harp Application.
* Host a single Harp application.
*
*/

exports.server = function(dirPath, options, callback){
return connect.createServer(
middleware.regProjectFinder(dirPath),
middleware.setup,
middleware.basicAuth,
middleware.underscore,
middleware.mwl,
middleware.static,
middleware.poly,
middleware.process,
middleware.fallback
).listen(options.port || 9966, options.ip, callback)
var app = connect()
app.use(middleware.regProjectFinder(dirPath))
app.use(middleware.setup)
app.use(middleware.basicAuth)
app.use(middleware.underscore)
app.use(middleware.mwl)
app.use(middleware.static)
app.use(middleware.poly)
app.use(middleware.process)
app.use(middleware.fallback)
app.listen(options.port || 9966, options.ip, callback)

return app
}


/**
* Multihost
*
* Host a single Harp Application.
* Host multiple Harp applications.
*
*/

exports.multihost = function(dirPath, options, callback){
return connect.createServer(
middleware.notMultihostURL,
middleware.index(dirPath),
middleware.hostProjectFinder(dirPath),
middleware.setup,
middleware.basicAuth,
middleware.underscore,
middleware.mwl,
middleware.static,
middleware.poly,
middleware.process,
middleware.fallback
).listen(options.port || 9000, callback)
var app = connect()
app.use(middleware.notMultihostURL)
app.use(middleware.index(dirPath))
app.use(middleware.hostProjectFinder(dirPath))
app.use(middleware.setup)
app.use(middleware.basicAuth)
app.use(middleware.underscore)
app.use(middleware.mwl)
app.use(middleware.static)
app.use(middleware.poly)
app.use(middleware.process)
app.use(middleware.fallback)
app.listen(options.port || 9000, callback)
}

/**
Expand Down
33 changes: 16 additions & 17 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ var terraform = require('terraform')
var pkg = require('../package.json')
var skin = require('./skin')
var connect = require('connect')

var send = require('../node_modules/connect/node_modules/send')
, utils = require('../node_modules/connect/lib/utils')
, parse = utils.parseUrl
, url = require('url')
var send = require('send')
var utilsPause = require('pause')
var utilsEscape = require('escape-html')
var parse = require('parseurl')
var url = require('url')

exports.notMultihostURL = function(req, rsp, next){
var host = req.headers.host
Expand Down Expand Up @@ -335,7 +335,7 @@ exports.static = function(req, res, next) {

if ('GET' != req.method && 'HEAD' != req.method) return next();
var pathn = parse(req).pathname;
var pause = utils.pause(req);
var pause = utilsPause(req);

function resume() {
next();
Expand All @@ -348,7 +348,7 @@ exports.static = function(req, res, next) {
var pathname = url.parse(req.originalUrl).pathname;
res.statusCode = 301;
res.setHeader('Location', pathname + '/');
res.end('Redirecting to ' + utils.escape(pathname) + '/');
res.end('Redirecting to ' + utilsEscape(pathname) + '/');
}

function error(err) {
Expand All @@ -362,17 +362,16 @@ exports.static = function(req, res, next) {
}

var serve = function(pathn){
send(req, pathn)
.maxage(options.maxAge || 0)
.root(req.setup.publicPath)
.hidden(options.hidden)
.on('error', error)
.on('directory', directory)
.pipe(res)
send(req, pathn, {
maxage: options.maxAge || 0,
root: req.setup.publicPath,
hidden: options.hidden
})
.on('error', error)
.on('directory', directory)
.pipe(res)
}

serve(pathn)

}

/**
Expand Down Expand Up @@ -485,7 +484,7 @@ exports.process = function(req, rsp, next){
// 301 redirect
rsp.statusCode = 301
rsp.setHeader('Location', prospectCleanPath)
rsp.end('Redirecting to ' + utils.escape(prospectCleanPath))
rsp.end('Redirecting to ' + utilsEscape(prospectCleanPath))
}

} else {
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@
"url": "https://github.com/sintaxi/harp.git"
},
"dependencies": {
"terraform": "0.12.0",
"commander": "2.0.0",
"connect": "2.9.0",
"async": "0.2.9",
"commander": "2.0.0",
"connect": "2.30.2",
"download-github-repo": "0.1.3",
"envy-json": "0.2.1",
"escape-html": "1.0.3",
"fs-extra": "0.18.2",
"mime": "1.2.11",
"download-github-repo": "0.1.3",
"envy-json": "0.2.1"
"parseurl": "1.3.0",
"pause": "0.1.0",
"send": "0.13.0",
"terraform": "0.12.0"
},
"devDependencies": {
"cheerio": "0.19.0",
Expand Down

0 comments on commit 3f2298d

Please sign in to comment.