Permalink
Browse files

Removed connect; included with express/node_modules

  • Loading branch information...
bbyars committed Jun 12, 2011
1 parent d354b0b commit 331f4e45ba9572bf087ceb18e49de75aaecfd666
Showing with 0 additions and 3,451 deletions.
  1. +0 −5 server/bin/httpmock
  2. +0 −11 server/deps/connect/.npmignore
  3. +0 −24 server/deps/connect/LICENSE
  4. +0 −2 server/deps/connect/index.js
  5. +0 −106 server/deps/connect/lib/connect.js
  6. +0 −218 server/deps/connect/lib/http.js
  7. +0 −47 server/deps/connect/lib/https.js
  8. +0 −41 server/deps/connect/lib/index.js
  9. +0 −93 server/deps/connect/lib/middleware/basicAuth.js
  10. +0 −92 server/deps/connect/lib/middleware/bodyParser.js
  11. +0 −163 server/deps/connect/lib/middleware/compiler.js
  12. +0 −46 server/deps/connect/lib/middleware/cookieParser.js
  13. +0 −100 server/deps/connect/lib/middleware/errorHandler.js
  14. +0 −76 server/deps/connect/lib/middleware/favicon.js
  15. +0 −78 server/deps/connect/lib/middleware/limit.js
  16. +0 −169 server/deps/connect/lib/middleware/logger.js
  17. +0 −38 server/deps/connect/lib/middleware/methodOverride.js
  18. +0 −100 server/deps/connect/lib/middleware/profiler.js
  19. +0 −34 server/deps/connect/lib/middleware/responseTime.js
  20. +0 −379 server/deps/connect/lib/middleware/router.js
  21. +0 −345 server/deps/connect/lib/middleware/session.js
  22. +0 −126 server/deps/connect/lib/middleware/session/cookie.js
  23. +0 −131 server/deps/connect/lib/middleware/session/memory.js
  24. +0 −137 server/deps/connect/lib/middleware/session/session.js
  25. +0 −59 server/deps/connect/lib/middleware/session/store.js
  26. +0 −222 server/deps/connect/lib/middleware/static.js
  27. +0 −44 server/deps/connect/lib/middleware/vhost.js
  28. +0 −51 server/deps/connect/lib/patch.js
  29. +0 −13 server/deps/connect/lib/public/error.html
  30. BIN server/deps/connect/lib/public/favicon.ico
  31. +0 −61 server/deps/connect/lib/public/style.css
  32. +0 −405 server/deps/connect/lib/utils.js
  33. +0 −22 server/deps/connect/package.json
  34. +0 −13 server/deps/connect/test.js
View
@@ -48,11 +48,6 @@ var serverAt = function (options) {
var basedir = __dirname.replace(/\w+$/, '');
-// Needed to require express locally; e.g. it does a require('connect')
-['connect/lib', 'qs', 'mime'].forEach(function (path) {
- require.paths.unshift(basedir + '/deps/' + path);
-});
-
require.paths.push(basedir);
require.paths.push(basedir + '/lib');
require.paths.push(basedir + '/deps');
@@ -1,11 +0,0 @@
-*.markdown
-*.md
-.git*
-Makefile
-benchmarks/
-docs/
-examples/
-install.sh
-support/
-test/
-.DS_Store
@@ -1,24 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2010 Sencha Inc.
-Copyright (c) 2011 LearnBoost
-Copyright (c) 2011 TJ Holowaychuk
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,2 +0,0 @@
-
-module.exports = require('./lib/connect');
@@ -1,106 +0,0 @@
-
-/*!
- * Connect
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var HTTPServer = require('./http').Server
- , HTTPSServer = require('./https').Server
- , fs = require('fs');
-
-// node patches
-
-require('./patch');
-
-// expose createServer() as the module
-
-exports = module.exports = createServer;
-
-/**
- * Framework version.
- */
-
-exports.version = '1.4.3';
-
-/**
- * Initialize a new `connect.HTTPServer` with the middleware
- * passed to this function. When an object is passed _first_,
- * we assume these are the tls options, and return a `connect.HTTPSServer`.
- *
- * Examples:
- *
- * An example HTTP server, accepting several middleware.
- *
- * var server = connect.createServer(
- * connect.logger()
- * , connect.static(__dirname + '/public')
- * );
- *
- * An HTTPS server, utilizing the same middleware as above.
- *
- * var server = connect.createServer(
- * { key: key, cert: cert }
- * , connect.logger()
- * , connect.static(__dirname + '/public')
- * );
- *
- * Alternatively with connect 1.0 we may omit `createServer()`.
- *
- * connect(
- * connect.logger()
- * , connect.static(__dirname + '/public')
- * ).listen(3000);
- *
- * @param {Object|Function} ...
- * @return {Server}
- * @api public
- */
-
-function createServer() {
- if ('object' == typeof arguments[0]) {
- return new HTTPSServer(arguments[0], Array.prototype.slice.call(arguments, 1));
- } else {
- return new HTTPServer(Array.prototype.slice.call(arguments));
- }
-};
-
-// support connect.createServer()
-
-exports.createServer = createServer;
-
-// auto-load getters
-
-exports.middleware = {};
-
-/**
- * Auto-load bundled middleware with getters.
- */
-
-fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
- if (/\.js$/.test(filename)) {
- var name = filename.substr(0, filename.lastIndexOf('.'));
- exports.middleware.__defineGetter__(name, function(){
- return require('./middleware/' + name);
- });
- }
-});
-
-// expose utils
-
-exports.utils = require('./utils');
-
-// expose getters as first-class exports
-
-exports.utils.merge(exports, exports.middleware);
-
-// expose constructors
-
-exports.HTTPServer = HTTPServer;
-exports.HTTPSServer = HTTPSServer;
-
@@ -1,218 +0,0 @@
-
-/*!
- * Connect - HTTPServer
- * Copyright(c) 2010 Sencha Inc.
- * Copyright(c) 2011 TJ Holowaychuk
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var http = require('http')
- , parse = require('url').parse
- , assert = require('assert');
-
-// environment
-
-var env = process.env.NODE_ENV || 'development';
-
-/**
- * Initialize a new `Server` with the given `middleware`.
- *
- * Examples:
- *
- * var server = connect.createServer(
- * connect.favicon()
- * , connect.logger()
- * , connect.static(__dirname + '/public')
- * );
- *
- * @params {Array} middleware
- * @return {Server}
- * @api public
- */
-
-var Server = exports.Server = function HTTPServer(middleware) {
- this.stack = [];
- middleware.forEach(function(fn){
- this.use(fn);
- }, this);
- http.Server.call(this, this.handle);
-};
-
-/**
- * Inherit from `http.Server.prototype`.
- */
-
-Server.prototype.__proto__ = http.Server.prototype;
-
-/**
- * Utilize the given middleware `handle` to the given `route`,
- * defaulting to _/_. This "route" is the mount-point for the
- * middleware, when given a value other than _/_ the middleware
- * is only effective when that segment is present in the request's
- * pathname.
- *
- * For example if we were to mount a function at _/admin_, it would
- * be invoked on _/admin_, and _/admin/settings_, however it would
- * not be invoked for _/_, or _/posts_.
- *
- * This is effectively the same as passing middleware to `connect.createServer()`,
- * however provides a progressive api.
- *
- * Examples:
- *
- * var server = connect.createServer();
- * server.use(connect.favicon());
- * server.use(connect.logger());
- * server.use(connect.static(__dirname + '/public'));
- *
- * If we wanted to prefix static files with _/public_, we could
- * "mount" the `static()` middleware:
- *
- * server.use('/public', connect.static(__dirname + '/public'));
- *
- * This api is chainable, meaning the following is valid:
- *
- * connect.createServer()
- * .use(connect.favicon())
- * .use(connect.logger())
- * .use(connect.static(__dirname + '/public'))
- * .listen(3000);
- *
- * @param {String|Function} route or handle
- * @param {Function} handle
- * @return {Server}
- * @api public
- */
-
-Server.prototype.use = function(route, handle){
- this.route = '/';
-
- // default route to '/'
- if ('string' != typeof route) {
- handle = route;
- route = '/';
- }
-
- // multiples
- if (arguments.length > 2) {
- return Array.prototype.slice.call(arguments, 1).forEach(function(fn){
- this.use(route, fn);
- }, this);
- }
-
- // wrap sub-apps
- if ('function' == typeof handle.handle) {
- var server = handle;
- server.route = route;
- handle = function(req, res, next) {
- server.handle(req, res, next);
- };
- }
-
- // wrap vanilla http.Servers
- if (handle instanceof http.Server) {
- handle = handle.listeners('request')[0];
- }
-
- // normalize route to not trail with slash
- if ('/' == route[route.length - 1]) {
- route = route.substr(0, route.length - 1);
- }
-
- // add the middleware
- this.stack.push({ route: route, handle: handle });
-
- // allow chaining
- return this;
-};
-
-/**
- * Handle server requests, punting them down
- * the middleware stack.
- *
- * @api private
- */
-
-Server.prototype.handle = function(req, res, out) {
- var writeHead = res.writeHead
- , stack = this.stack
- , removed = ''
- , index = 0;
-
- function next(err) {
- req.url = removed + req.url;
- req.originalUrl = req.originalUrl || req.url;
- removed = '';
-
- var layer = stack[index++];
-
- // all done
- if (!layer) {
- // but wait! we have a parent
- if (out) return out(err);
-
- // otherwise send a proper error message to the browser.
- if (err) {
- var msg = 'production' == env
- ? 'Internal Server Error'
- : err.stack || err.toString();
-
- // output to stderr in a non-test env
- if ('test' != env) console.error(err.stack || err.toString());
-
- res.statusCode = 500;
- res.setHeader('Content-Type', 'text/plain');
- res.end(msg);
- } else {
- res.statusCode = 404;
- res.setHeader('Content-Type', 'text/plain');
- res.end('Cannot ' + req.method + ' ' + req.url);
- }
- return;
- }
-
- try {
- var pathname = parse(req.url).pathname;
- if (undefined == pathname) pathname = '/';
-
- // skip this layer if the route doesn't match.
- if (0 != pathname.indexOf(layer.route)) return next(err);
-
- var nextChar = pathname[layer.route.length];
- if (nextChar && '/' != nextChar && '.' != nextChar) return next(err);
-
- // Call the layer handler
- // Trim off the part of the url that matches the route
- removed = layer.route;
- req.url = req.url.substr(removed.length);
-
- // Ensure leading slash
- if ('/' != req.url[0]) req.url = '/' + req.url;
-
- var arity = layer.handle.length;
- if (err) {
- if (arity === 4) {
- layer.handle(err, req, res, next);
- } else {
- next(err);
- }
- } else if (arity < 4) {
- layer.handle(req, res, next);
- } else {
- next();
- }
- } catch (e) {
- if (e instanceof assert.AssertionError) {
- console.error(e.stack + '\n');
- next(e);
- } else {
- next(e);
- }
- }
- }
- next();
-};
Oops, something went wrong.

0 comments on commit 331f4e4

Please sign in to comment.