1 |
|
2 | /*!
|
3 | * Connect - HTTPServer
|
4 | * Copyright(c) 2010 Sencha Inc.
|
5 | * Copyright(c) 2011 TJ Holowaychuk
|
6 | * MIT Licensed
|
7 | */
|
8 |
|
9 | /**
|
10 | * Module dependencies.
|
11 | */
|
12 |
|
13 | var HTTPServer = require('./http').Server
|
14 | , https = require('https');
|
15 |
|
16 | /**
|
17 | * Initialize a new `Server` with the given
|
18 | *`options` and `middleware`. The HTTPS api
|
19 | * is identical to the [HTTP](http.html) server,
|
20 | * however TLS `options` must be provided before
|
21 | * passing in the optional middleware.
|
22 | *
|
23 | * @params {Object} options
|
24 | * @params {Array} middleawre
|
25 | * @return {Server}
|
26 | * @api public
|
27 | */
|
28 |
|
29 | var Server = exports.Server = function HTTPSServer(options, middleware) {
|
30 | this.stack = [];
|
31 | middleware.forEach(function(fn){
|
32 | this.use(fn);
|
33 | }, this);
|
34 | https.Server.call(this, options, this.handle);
|
35 | };
|
36 |
|
37 | /**
|
38 | * Inherit from `http.Server.prototype`.
|
39 | */
|
40 |
|
41 | Server.prototype.__proto__ = https.Server.prototype;
|
42 |
|
43 | // mixin HTTPServer methods
|
44 |
|
45 | Object.keys(HTTPServer.prototype).forEach(function(method){
|
46 | Server.prototype[method] = HTTPServer.prototype[method];
|
47 | }); |
\ | No newline at end of file |