diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-06 22:18:28 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-06 22:18:28 +0200 |
commit | 83354b2b88218090988dd6e526b0a2505b57e0f1 (patch) | |
tree | e3c73c38a122a78bb7e66fbb99056407edd9d4b9 /includes/external/addressbook/node_modules/http2-wrapper/source/proxies/h2-over-hx.js | |
parent | 47b8f2299a483024c4a6a8876af825a010954caa (diff) | |
download | pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.tar.gz pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.tar.bz2 pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.zip |
Updated 5 files and added 1110 files (automated)
Diffstat (limited to 'includes/external/addressbook/node_modules/http2-wrapper/source/proxies/h2-over-hx.js')
-rw-r--r-- | includes/external/addressbook/node_modules/http2-wrapper/source/proxies/h2-over-hx.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/http2-wrapper/source/proxies/h2-over-hx.js b/includes/external/addressbook/node_modules/http2-wrapper/source/proxies/h2-over-hx.js new file mode 100644 index 0000000..0f5a104 --- /dev/null +++ b/includes/external/addressbook/node_modules/http2-wrapper/source/proxies/h2-over-hx.js @@ -0,0 +1,40 @@ +'use strict'; +const {Agent} = require('../agent.js'); +const JSStreamSocket = require('../utils/js-stream-socket.js'); +const UnexpectedStatusCodeError = require('./unexpected-status-code-error.js'); +const initialize = require('./initialize.js'); + +class Http2OverHttpX extends Agent { + constructor(options) { + super(options); + + initialize(this, options.proxyOptions); + } + + async createConnection(origin, options) { + const authority = `${origin.hostname}:${origin.port || 443}`; + + const [stream, statusCode, statusMessage] = await this._getProxyStream(authority); + if (statusCode !== 200) { + throw new UnexpectedStatusCodeError(statusCode, statusMessage); + } + + if (this.proxyOptions.raw) { + options.socket = stream; + } else { + const socket = new JSStreamSocket(stream); + socket.encrypted = false; + socket._handle.getpeername = out => { + out.family = undefined; + out.address = undefined; + out.port = undefined; + }; + + return socket; + } + + return super.createConnection(origin, options); + } +} + +module.exports = Http2OverHttpX; |