1 | 'use strict'
|
2 |
|
3 | var util = require('util')
|
4 | var net = require('net')
|
5 |
|
6 | function Socket (parent, options) {
|
7 | net.Socket.call(this, options)
|
8 |
|
9 | var state = {}
|
10 |
|
11 | this._spdyState = state
|
12 |
|
13 | state.parent = parent
|
14 |
|
15 | this.servername = parent.servername
|
16 | this.npnProtocol = parent.npnProtocol
|
17 | this.alpnProtocol = parent.alpnProtocol
|
18 | this.authorized = parent.authorized
|
19 | this.authorizationError = parent.authorizationError
|
20 | this.encrypted = true
|
21 | this.allowHalfOpen = true
|
22 | }
|
23 |
|
24 | util.inherits(Socket, net.Socket)
|
25 |
|
26 | module.exports = Socket
|
27 |
|
28 | var methods = [
|
29 | 'renegotiate', 'setMaxSendFragment', 'getTLSTicket', 'setServername',
|
30 | 'setSession', 'getPeerCertificate', 'getSession', 'isSessionReused',
|
31 | 'getCipher', 'getEphemeralKeyInfo'
|
32 | ]
|
33 |
|
34 | methods.forEach(function (method) {
|
35 | Socket.prototype[method] = function methodWrap () {
|
36 | var parent = this._spdyState.parent
|
37 | return parent[method].apply(parent, arguments)
|
38 | }
|
39 | })
|