-
Notifications
You must be signed in to change notification settings - Fork 4
/
spdy.js
67 lines (52 loc) · 1.28 KB
/
spdy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*!
* Express - SPDYServer
* Copyright(c) 2010 TJ Holowaychuk <[email protected]>
* MIT Licensed
*/
/**
* Module dependencies.
*/
var connect = require('connect-spdy')
, express = require('express')
, HTTPServer = express.HTTPServer
, spdy = require('spdy')
, spdy_res = spdy.Response.prototype
, http = require('http')
, res = http.ServerResponse.prototype;
/**
* Expose `SPDYServer`.
*/
exports = module.exports = SPDYServer;
/**
* Server proto.
*/
var app = SPDYServer.prototype;
/**
* Initialize a new `SPDYServer` with the
* given `options`, and optional `middleware`.
*
* @param {Object} options
* @param {Array} middleware
* @api public
*/
function SPDYServer(options, middleware){
connect.SPDYServer.call(this, options, []);
this.init(middleware);
};
/**
* Inherit from `connect.SPDYServer`.
*/
app.__proto__ = connect.SPDYServer.prototype;
// mixin HTTPServer methods
Object.keys(HTTPServer.prototype).forEach(function(method){
app[method] = HTTPServer.prototype[method];
});
// TODO: don't hard-code which methods get mixed-in
spdy_res.partial = res.partial;
spdy_res.render = res.render;
spdy_res._render = res._render;
// TODO: mixin
// spdy_res.send = res.send;
// spdy_res.header = res.header;
// spdy_res.contentType = res.contentType;
// ...