stuff
This commit is contained in:
174
buildfiles/node_modules/global-agent/dist/classes/Agent.js
generated
vendored
Normal file
174
buildfiles/node_modules/global-agent/dist/classes/Agent.js
generated
vendored
Normal file
@ -0,0 +1,174 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _serializeError = require("serialize-error");
|
||||
|
||||
var _boolean = require("boolean");
|
||||
|
||||
var _Logger = _interopRequireDefault(require("../Logger"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const log = _Logger.default.child({
|
||||
namespace: 'Agent'
|
||||
});
|
||||
|
||||
let requestId = 0;
|
||||
|
||||
class Agent {
|
||||
constructor(isProxyConfigured, mustUrlUseProxy, getUrlProxy, fallbackAgent, socketConnectionTimeout) {
|
||||
this.fallbackAgent = fallbackAgent;
|
||||
this.isProxyConfigured = isProxyConfigured;
|
||||
this.mustUrlUseProxy = mustUrlUseProxy;
|
||||
this.getUrlProxy = getUrlProxy;
|
||||
this.socketConnectionTimeout = socketConnectionTimeout;
|
||||
}
|
||||
|
||||
addRequest(request, configuration) {
|
||||
let requestUrl; // It is possible that addRequest was constructed for a proxied request already, e.g.
|
||||
// "request" package does this when it detects that a proxy should be used
|
||||
// https://github.com/request/request/blob/212570b6971a732b8dd9f3c73354bcdda158a737/request.js#L402
|
||||
// https://gist.github.com/gajus/e2074cd3b747864ffeaabbd530d30218
|
||||
|
||||
if (request.path.startsWith('http://') || request.path.startsWith('https://')) {
|
||||
requestUrl = request.path;
|
||||
} else {
|
||||
requestUrl = this.protocol + '//' + (configuration.hostname || configuration.host) + (configuration.port === 80 || configuration.port === 443 ? '' : ':' + configuration.port) + request.path;
|
||||
}
|
||||
|
||||
if (!this.isProxyConfigured()) {
|
||||
log.trace({
|
||||
destination: requestUrl
|
||||
}, 'not proxying request; GLOBAL_AGENT.HTTP_PROXY is not configured'); // $FlowFixMe It appears that Flow is missing the method description.
|
||||
|
||||
this.fallbackAgent.addRequest(request, configuration);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.mustUrlUseProxy(requestUrl)) {
|
||||
log.trace({
|
||||
destination: requestUrl
|
||||
}, 'not proxying request; url matches GLOBAL_AGENT.NO_PROXY'); // $FlowFixMe It appears that Flow is missing the method description.
|
||||
|
||||
this.fallbackAgent.addRequest(request, configuration);
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRequestId = requestId++;
|
||||
const proxy = this.getUrlProxy(requestUrl);
|
||||
|
||||
if (this.protocol === 'http:') {
|
||||
request.path = requestUrl;
|
||||
|
||||
if (proxy.authorization) {
|
||||
request.setHeader('proxy-authorization', 'Basic ' + Buffer.from(proxy.authorization).toString('base64'));
|
||||
}
|
||||
}
|
||||
|
||||
log.trace({
|
||||
destination: requestUrl,
|
||||
proxy: 'http://' + proxy.hostname + ':' + proxy.port,
|
||||
requestId: currentRequestId
|
||||
}, 'proxying request');
|
||||
request.on('error', error => {
|
||||
log.error({
|
||||
error: (0, _serializeError.serializeError)(error)
|
||||
}, 'request error');
|
||||
});
|
||||
request.once('response', response => {
|
||||
log.trace({
|
||||
headers: response.headers,
|
||||
requestId: currentRequestId,
|
||||
statusCode: response.statusCode
|
||||
}, 'proxying response');
|
||||
});
|
||||
request.shouldKeepAlive = false;
|
||||
const connectionConfiguration = {
|
||||
host: configuration.hostname || configuration.host,
|
||||
port: configuration.port || 80,
|
||||
proxy,
|
||||
tls: {}
|
||||
}; // add optional tls options for https requests.
|
||||
// @see https://nodejs.org/docs/latest-v12.x/api/https.html#https_https_request_url_options_callback :
|
||||
// > The following additional options from tls.connect()
|
||||
// > - https://nodejs.org/docs/latest-v12.x/api/tls.html#tls_tls_connect_options_callback -
|
||||
// > are also accepted:
|
||||
// > ca, cert, ciphers, clientCertEngine, crl, dhparam, ecdhCurve, honorCipherOrder,
|
||||
// > key, passphrase, pfx, rejectUnauthorized, secureOptions, secureProtocol, servername, sessionIdContext.
|
||||
|
||||
if (this.protocol === 'https:') {
|
||||
connectionConfiguration.tls = {
|
||||
ca: configuration.ca,
|
||||
cert: configuration.cert,
|
||||
ciphers: configuration.ciphers,
|
||||
clientCertEngine: configuration.clientCertEngine,
|
||||
crl: configuration.crl,
|
||||
dhparam: configuration.dhparam,
|
||||
ecdhCurve: configuration.ecdhCurve,
|
||||
honorCipherOrder: configuration.honorCipherOrder,
|
||||
key: configuration.key,
|
||||
passphrase: configuration.passphrase,
|
||||
pfx: configuration.pfx,
|
||||
rejectUnauthorized: configuration.rejectUnauthorized,
|
||||
secureOptions: configuration.secureOptions,
|
||||
secureProtocol: configuration.secureProtocol,
|
||||
servername: configuration.servername || connectionConfiguration.host,
|
||||
sessionIdContext: configuration.sessionIdContext
|
||||
}; // This is not ideal because there is no way to override this setting using `tls` configuration if `NODE_TLS_REJECT_UNAUTHORIZED=0`.
|
||||
// However, popular HTTP clients (such as https://github.com/sindresorhus/got) come with pre-configured value for `rejectUnauthorized`,
|
||||
// which makes it impossible to override that value globally and respect `rejectUnauthorized` for specific requests only.
|
||||
//
|
||||
// eslint-disable-next-line no-process-env
|
||||
|
||||
if (typeof process.env.NODE_TLS_REJECT_UNAUTHORIZED === 'string' && (0, _boolean.boolean)(process.env.NODE_TLS_REJECT_UNAUTHORIZED) === false) {
|
||||
connectionConfiguration.tls.rejectUnauthorized = false;
|
||||
}
|
||||
} // $FlowFixMe It appears that Flow is missing the method description.
|
||||
|
||||
|
||||
this.createConnection(connectionConfiguration, (error, socket) => {
|
||||
log.trace({
|
||||
target: connectionConfiguration
|
||||
}, 'connecting'); // @see https://github.com/nodejs/node/issues/5757#issuecomment-305969057
|
||||
|
||||
if (socket) {
|
||||
socket.setTimeout(this.socketConnectionTimeout, () => {
|
||||
socket.destroy();
|
||||
});
|
||||
socket.once('connect', () => {
|
||||
log.trace({
|
||||
target: connectionConfiguration
|
||||
}, 'connected');
|
||||
socket.setTimeout(0);
|
||||
});
|
||||
socket.once('secureConnect', () => {
|
||||
log.trace({
|
||||
target: connectionConfiguration
|
||||
}, 'connected (secure)');
|
||||
socket.setTimeout(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (error) {
|
||||
request.emit('error', error);
|
||||
} else {
|
||||
log.debug('created socket');
|
||||
socket.on('error', socketError => {
|
||||
log.error({
|
||||
error: (0, _serializeError.serializeError)(socketError)
|
||||
}, 'socket error');
|
||||
});
|
||||
request.onSocket(socket);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var _default = Agent;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=Agent.js.map
|
212
buildfiles/node_modules/global-agent/dist/classes/Agent.js.flow
generated
vendored
Normal file
212
buildfiles/node_modules/global-agent/dist/classes/Agent.js.flow
generated
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
// @flow
|
||||
|
||||
import {
|
||||
serializeError,
|
||||
} from 'serialize-error';
|
||||
import {
|
||||
boolean,
|
||||
} from 'boolean';
|
||||
import Logger from '../Logger';
|
||||
import type {
|
||||
AgentType,
|
||||
GetUrlProxyMethodType,
|
||||
IsProxyConfiguredMethodType,
|
||||
MustUrlUseProxyMethodType,
|
||||
ProtocolType,
|
||||
} from '../types';
|
||||
|
||||
const log = Logger.child({
|
||||
namespace: 'Agent',
|
||||
});
|
||||
|
||||
let requestId = 0;
|
||||
|
||||
class Agent {
|
||||
defaultPort: number;
|
||||
|
||||
protocol: ProtocolType;
|
||||
|
||||
fallbackAgent: AgentType;
|
||||
|
||||
isProxyConfigured: IsProxyConfiguredMethodType;
|
||||
|
||||
mustUrlUseProxy: MustUrlUseProxyMethodType;
|
||||
|
||||
getUrlProxy: GetUrlProxyMethodType;
|
||||
|
||||
socketConnectionTimeout: number;
|
||||
|
||||
constructor (
|
||||
isProxyConfigured: IsProxyConfiguredMethodType,
|
||||
mustUrlUseProxy: MustUrlUseProxyMethodType,
|
||||
getUrlProxy: GetUrlProxyMethodType,
|
||||
fallbackAgent: AgentType,
|
||||
socketConnectionTimeout: number,
|
||||
) {
|
||||
this.fallbackAgent = fallbackAgent;
|
||||
this.isProxyConfigured = isProxyConfigured;
|
||||
this.mustUrlUseProxy = mustUrlUseProxy;
|
||||
this.getUrlProxy = getUrlProxy;
|
||||
this.socketConnectionTimeout = socketConnectionTimeout;
|
||||
}
|
||||
|
||||
addRequest (request: *, configuration: *) {
|
||||
let requestUrl;
|
||||
|
||||
// It is possible that addRequest was constructed for a proxied request already, e.g.
|
||||
// "request" package does this when it detects that a proxy should be used
|
||||
// https://github.com/request/request/blob/212570b6971a732b8dd9f3c73354bcdda158a737/request.js#L402
|
||||
// https://gist.github.com/gajus/e2074cd3b747864ffeaabbd530d30218
|
||||
if (request.path.startsWith('http://') || request.path.startsWith('https://')) {
|
||||
requestUrl = request.path;
|
||||
} else {
|
||||
requestUrl = this.protocol + '//' + (configuration.hostname || configuration.host) + (configuration.port === 80 || configuration.port === 443 ? '' : ':' + configuration.port) + request.path;
|
||||
}
|
||||
|
||||
if (!this.isProxyConfigured()) {
|
||||
log.trace({
|
||||
destination: requestUrl,
|
||||
}, 'not proxying request; GLOBAL_AGENT.HTTP_PROXY is not configured');
|
||||
|
||||
// $FlowFixMe It appears that Flow is missing the method description.
|
||||
this.fallbackAgent.addRequest(request, configuration);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.mustUrlUseProxy(requestUrl)) {
|
||||
log.trace({
|
||||
destination: requestUrl,
|
||||
}, 'not proxying request; url matches GLOBAL_AGENT.NO_PROXY');
|
||||
|
||||
// $FlowFixMe It appears that Flow is missing the method description.
|
||||
this.fallbackAgent.addRequest(request, configuration);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRequestId = requestId++;
|
||||
|
||||
const proxy = this.getUrlProxy(requestUrl);
|
||||
|
||||
if (this.protocol === 'http:') {
|
||||
request.path = requestUrl;
|
||||
|
||||
if (proxy.authorization) {
|
||||
request.setHeader('proxy-authorization', 'Basic ' + Buffer.from(proxy.authorization).toString('base64'));
|
||||
}
|
||||
}
|
||||
|
||||
log.trace({
|
||||
destination: requestUrl,
|
||||
proxy: 'http://' + proxy.hostname + ':' + proxy.port,
|
||||
requestId: currentRequestId,
|
||||
}, 'proxying request');
|
||||
|
||||
request.on('error', (error) => {
|
||||
log.error({
|
||||
error: serializeError(error),
|
||||
}, 'request error');
|
||||
});
|
||||
|
||||
request.once('response', (response) => {
|
||||
log.trace({
|
||||
headers: response.headers,
|
||||
requestId: currentRequestId,
|
||||
statusCode: response.statusCode,
|
||||
}, 'proxying response');
|
||||
});
|
||||
|
||||
request.shouldKeepAlive = false;
|
||||
|
||||
const connectionConfiguration = {
|
||||
host: configuration.hostname || configuration.host,
|
||||
port: configuration.port || 80,
|
||||
proxy,
|
||||
tls: {},
|
||||
};
|
||||
|
||||
// add optional tls options for https requests.
|
||||
// @see https://nodejs.org/docs/latest-v12.x/api/https.html#https_https_request_url_options_callback :
|
||||
// > The following additional options from tls.connect()
|
||||
// > - https://nodejs.org/docs/latest-v12.x/api/tls.html#tls_tls_connect_options_callback -
|
||||
// > are also accepted:
|
||||
// > ca, cert, ciphers, clientCertEngine, crl, dhparam, ecdhCurve, honorCipherOrder,
|
||||
// > key, passphrase, pfx, rejectUnauthorized, secureOptions, secureProtocol, servername, sessionIdContext.
|
||||
if (this.protocol === 'https:') {
|
||||
connectionConfiguration.tls = {
|
||||
ca: configuration.ca,
|
||||
cert: configuration.cert,
|
||||
ciphers: configuration.ciphers,
|
||||
clientCertEngine: configuration.clientCertEngine,
|
||||
crl: configuration.crl,
|
||||
dhparam: configuration.dhparam,
|
||||
ecdhCurve: configuration.ecdhCurve,
|
||||
honorCipherOrder: configuration.honorCipherOrder,
|
||||
key: configuration.key,
|
||||
passphrase: configuration.passphrase,
|
||||
pfx: configuration.pfx,
|
||||
rejectUnauthorized: configuration.rejectUnauthorized,
|
||||
secureOptions: configuration.secureOptions,
|
||||
secureProtocol: configuration.secureProtocol,
|
||||
servername: configuration.servername || connectionConfiguration.host,
|
||||
sessionIdContext: configuration.sessionIdContext,
|
||||
};
|
||||
|
||||
// This is not ideal because there is no way to override this setting using `tls` configuration if `NODE_TLS_REJECT_UNAUTHORIZED=0`.
|
||||
// However, popular HTTP clients (such as https://github.com/sindresorhus/got) come with pre-configured value for `rejectUnauthorized`,
|
||||
// which makes it impossible to override that value globally and respect `rejectUnauthorized` for specific requests only.
|
||||
//
|
||||
// eslint-disable-next-line no-process-env
|
||||
if (typeof process.env.NODE_TLS_REJECT_UNAUTHORIZED === 'string' && boolean(process.env.NODE_TLS_REJECT_UNAUTHORIZED) === false) {
|
||||
connectionConfiguration.tls.rejectUnauthorized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// $FlowFixMe It appears that Flow is missing the method description.
|
||||
this.createConnection(connectionConfiguration, (error, socket) => {
|
||||
log.trace({
|
||||
target: connectionConfiguration,
|
||||
}, 'connecting');
|
||||
|
||||
// @see https://github.com/nodejs/node/issues/5757#issuecomment-305969057
|
||||
if (socket) {
|
||||
socket.setTimeout(this.socketConnectionTimeout, () => {
|
||||
socket.destroy();
|
||||
});
|
||||
|
||||
socket.once('connect', () => {
|
||||
log.trace({
|
||||
target: connectionConfiguration,
|
||||
}, 'connected');
|
||||
|
||||
socket.setTimeout(0);
|
||||
});
|
||||
|
||||
socket.once('secureConnect', () => {
|
||||
log.trace({
|
||||
target: connectionConfiguration,
|
||||
}, 'connected (secure)');
|
||||
|
||||
socket.setTimeout(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (error) {
|
||||
request.emit('error', error);
|
||||
} else {
|
||||
log.debug('created socket');
|
||||
|
||||
socket.on('error', (socketError) => {
|
||||
log.error({
|
||||
error: serializeError(socketError),
|
||||
}, 'socket error');
|
||||
});
|
||||
|
||||
request.onSocket(socket);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default Agent;
|
1
buildfiles/node_modules/global-agent/dist/classes/Agent.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/classes/Agent.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
buildfiles/node_modules/global-agent/dist/classes/HttpProxyAgent.js
generated
vendored
Normal file
33
buildfiles/node_modules/global-agent/dist/classes/HttpProxyAgent.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _net = _interopRequireDefault(require("net"));
|
||||
|
||||
var _Agent = _interopRequireDefault(require("./Agent"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class HttpProxyAgent extends _Agent.default {
|
||||
// @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/169#issuecomment-486980290
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.protocol = 'http:';
|
||||
this.defaultPort = 80;
|
||||
}
|
||||
|
||||
createConnection(configuration, callback) {
|
||||
const socket = _net.default.connect(configuration.proxy.port, configuration.proxy.hostname);
|
||||
|
||||
callback(null, socket);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var _default = HttpProxyAgent;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=HttpProxyAgent.js.map
|
30
buildfiles/node_modules/global-agent/dist/classes/HttpProxyAgent.js.flow
generated
vendored
Normal file
30
buildfiles/node_modules/global-agent/dist/classes/HttpProxyAgent.js.flow
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// @flow
|
||||
|
||||
import net from 'net';
|
||||
import type {
|
||||
ConnectionCallbackType,
|
||||
ConnectionConfigurationType,
|
||||
} from '../types';
|
||||
import Agent from './Agent';
|
||||
|
||||
class HttpProxyAgent extends Agent {
|
||||
// @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/169#issuecomment-486980290
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
constructor (...args: *) {
|
||||
super(...args);
|
||||
|
||||
this.protocol = 'http:';
|
||||
this.defaultPort = 80;
|
||||
}
|
||||
|
||||
createConnection (configuration: ConnectionConfigurationType, callback: ConnectionCallbackType) {
|
||||
const socket = net.connect(
|
||||
configuration.proxy.port,
|
||||
configuration.proxy.hostname,
|
||||
);
|
||||
|
||||
callback(null, socket);
|
||||
}
|
||||
}
|
||||
|
||||
export default HttpProxyAgent;
|
1
buildfiles/node_modules/global-agent/dist/classes/HttpProxyAgent.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/classes/HttpProxyAgent.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/classes/HttpProxyAgent.js"],"names":["HttpProxyAgent","Agent","constructor","args","protocol","defaultPort","createConnection","configuration","callback","socket","net","connect","proxy","port","hostname"],"mappings":";;;;;;;AAEA;;AAKA;;;;AAEA,MAAMA,cAAN,SAA6BC,cAA7B,CAAmC;AACjC;AACA;AACAC,EAAAA,WAAW,CAAE,GAAGC,IAAL,EAAc;AACvB,UAAM,GAAGA,IAAT;AAEA,SAAKC,QAAL,GAAgB,OAAhB;AACA,SAAKC,WAAL,GAAmB,EAAnB;AACD;;AAEDC,EAAAA,gBAAgB,CAAEC,aAAF,EAA8CC,QAA9C,EAAgF;AAC9F,UAAMC,MAAM,GAAGC,aAAIC,OAAJ,CACbJ,aAAa,CAACK,KAAd,CAAoBC,IADP,EAEbN,aAAa,CAACK,KAAd,CAAoBE,QAFP,CAAf;;AAKAN,IAAAA,QAAQ,CAAC,IAAD,EAAOC,MAAP,CAAR;AACD;;AAjBgC;;eAoBpBT,c","sourcesContent":["// @flow\n\nimport net from 'net';\nimport type {\n ConnectionCallbackType,\n ConnectionConfigurationType,\n} from '../types';\nimport Agent from './Agent';\n\nclass HttpProxyAgent extends Agent {\n // @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/169#issuecomment-486980290\n // eslint-disable-next-line unicorn/prevent-abbreviations\n constructor (...args: *) {\n super(...args);\n\n this.protocol = 'http:';\n this.defaultPort = 80;\n }\n\n createConnection (configuration: ConnectionConfigurationType, callback: ConnectionCallbackType) {\n const socket = net.connect(\n configuration.proxy.port,\n configuration.proxy.hostname,\n );\n\n callback(null, socket);\n }\n}\n\nexport default HttpProxyAgent;\n"],"file":"HttpProxyAgent.js"}
|
53
buildfiles/node_modules/global-agent/dist/classes/HttpsProxyAgent.js
generated
vendored
Normal file
53
buildfiles/node_modules/global-agent/dist/classes/HttpsProxyAgent.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _net = _interopRequireDefault(require("net"));
|
||||
|
||||
var _tls = _interopRequireDefault(require("tls"));
|
||||
|
||||
var _Agent = _interopRequireDefault(require("./Agent"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class HttpsProxyAgent extends _Agent.default {
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.protocol = 'https:';
|
||||
this.defaultPort = 443;
|
||||
}
|
||||
|
||||
createConnection(configuration, callback) {
|
||||
const socket = _net.default.connect(configuration.proxy.port, configuration.proxy.hostname);
|
||||
|
||||
socket.on('error', error => {
|
||||
callback(error);
|
||||
});
|
||||
socket.once('data', () => {
|
||||
const secureSocket = _tls.default.connect({ ...configuration.tls,
|
||||
socket
|
||||
});
|
||||
|
||||
callback(null, secureSocket);
|
||||
});
|
||||
let connectMessage = '';
|
||||
connectMessage += 'CONNECT ' + configuration.host + ':' + configuration.port + ' HTTP/1.1\r\n';
|
||||
connectMessage += 'Host: ' + configuration.host + ':' + configuration.port + '\r\n';
|
||||
|
||||
if (configuration.proxy.authorization) {
|
||||
connectMessage += 'Proxy-Authorization: Basic ' + Buffer.from(configuration.proxy.authorization).toString('base64') + '\r\n';
|
||||
}
|
||||
|
||||
connectMessage += '\r\n';
|
||||
socket.write(connectMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var _default = HttpsProxyAgent;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=HttpsProxyAgent.js.map
|
54
buildfiles/node_modules/global-agent/dist/classes/HttpsProxyAgent.js.flow
generated
vendored
Normal file
54
buildfiles/node_modules/global-agent/dist/classes/HttpsProxyAgent.js.flow
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
// @flow
|
||||
|
||||
import net from 'net';
|
||||
import tls from 'tls';
|
||||
import type {
|
||||
ConnectionCallbackType,
|
||||
ConnectionConfigurationType,
|
||||
} from '../types';
|
||||
import Agent from './Agent';
|
||||
|
||||
class HttpsProxyAgent extends Agent {
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
constructor (...args: *) {
|
||||
super(...args);
|
||||
|
||||
this.protocol = 'https:';
|
||||
this.defaultPort = 443;
|
||||
}
|
||||
|
||||
createConnection (configuration: ConnectionConfigurationType, callback: ConnectionCallbackType) {
|
||||
const socket = net.connect(
|
||||
configuration.proxy.port,
|
||||
configuration.proxy.hostname,
|
||||
);
|
||||
|
||||
socket.on('error', (error) => {
|
||||
callback(error);
|
||||
});
|
||||
|
||||
socket.once('data', () => {
|
||||
const secureSocket = tls.connect({
|
||||
...configuration.tls,
|
||||
socket,
|
||||
});
|
||||
|
||||
callback(null, secureSocket);
|
||||
});
|
||||
|
||||
let connectMessage = '';
|
||||
|
||||
connectMessage += 'CONNECT ' + configuration.host + ':' + configuration.port + ' HTTP/1.1\r\n';
|
||||
connectMessage += 'Host: ' + configuration.host + ':' + configuration.port + '\r\n';
|
||||
|
||||
if (configuration.proxy.authorization) {
|
||||
connectMessage += 'Proxy-Authorization: Basic ' + Buffer.from(configuration.proxy.authorization).toString('base64') + '\r\n';
|
||||
}
|
||||
|
||||
connectMessage += '\r\n';
|
||||
|
||||
socket.write(connectMessage);
|
||||
}
|
||||
}
|
||||
|
||||
export default HttpsProxyAgent;
|
1
buildfiles/node_modules/global-agent/dist/classes/HttpsProxyAgent.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/classes/HttpsProxyAgent.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/classes/HttpsProxyAgent.js"],"names":["HttpsProxyAgent","Agent","constructor","args","protocol","defaultPort","createConnection","configuration","callback","socket","net","connect","proxy","port","hostname","on","error","once","secureSocket","tls","connectMessage","host","authorization","Buffer","from","toString","write"],"mappings":";;;;;;;AAEA;;AACA;;AAKA;;;;AAEA,MAAMA,eAAN,SAA8BC,cAA9B,CAAoC;AAClC;AACAC,EAAAA,WAAW,CAAE,GAAGC,IAAL,EAAc;AACvB,UAAM,GAAGA,IAAT;AAEA,SAAKC,QAAL,GAAgB,QAAhB;AACA,SAAKC,WAAL,GAAmB,GAAnB;AACD;;AAEDC,EAAAA,gBAAgB,CAAEC,aAAF,EAA8CC,QAA9C,EAAgF;AAC9F,UAAMC,MAAM,GAAGC,aAAIC,OAAJ,CACbJ,aAAa,CAACK,KAAd,CAAoBC,IADP,EAEbN,aAAa,CAACK,KAAd,CAAoBE,QAFP,CAAf;;AAKAL,IAAAA,MAAM,CAACM,EAAP,CAAU,OAAV,EAAoBC,KAAD,IAAW;AAC5BR,MAAAA,QAAQ,CAACQ,KAAD,CAAR;AACD,KAFD;AAIAP,IAAAA,MAAM,CAACQ,IAAP,CAAY,MAAZ,EAAoB,MAAM;AACxB,YAAMC,YAAY,GAAGC,aAAIR,OAAJ,CAAY,EAC/B,GAAGJ,aAAa,CAACY,GADc;AAE/BV,QAAAA;AAF+B,OAAZ,CAArB;;AAKAD,MAAAA,QAAQ,CAAC,IAAD,EAAOU,YAAP,CAAR;AACD,KAPD;AASA,QAAIE,cAAc,GAAG,EAArB;AAEAA,IAAAA,cAAc,IAAI,aAAab,aAAa,CAACc,IAA3B,GAAkC,GAAlC,GAAwCd,aAAa,CAACM,IAAtD,GAA6D,eAA/E;AACAO,IAAAA,cAAc,IAAI,WAAWb,aAAa,CAACc,IAAzB,GAAgC,GAAhC,GAAsCd,aAAa,CAACM,IAApD,GAA2D,MAA7E;;AAEA,QAAIN,aAAa,CAACK,KAAd,CAAoBU,aAAxB,EAAuC;AACrCF,MAAAA,cAAc,IAAI,gCAAgCG,MAAM,CAACC,IAAP,CAAYjB,aAAa,CAACK,KAAd,CAAoBU,aAAhC,EAA+CG,QAA/C,CAAwD,QAAxD,CAAhC,GAAoG,MAAtH;AACD;;AAEDL,IAAAA,cAAc,IAAI,MAAlB;AAEAX,IAAAA,MAAM,CAACiB,KAAP,CAAaN,cAAb;AACD;;AAxCiC;;eA2CrBpB,e","sourcesContent":["// @flow\n\nimport net from 'net';\nimport tls from 'tls';\nimport type {\n ConnectionCallbackType,\n ConnectionConfigurationType,\n} from '../types';\nimport Agent from './Agent';\n\nclass HttpsProxyAgent extends Agent {\n // eslint-disable-next-line unicorn/prevent-abbreviations\n constructor (...args: *) {\n super(...args);\n\n this.protocol = 'https:';\n this.defaultPort = 443;\n }\n\n createConnection (configuration: ConnectionConfigurationType, callback: ConnectionCallbackType) {\n const socket = net.connect(\n configuration.proxy.port,\n configuration.proxy.hostname,\n );\n\n socket.on('error', (error) => {\n callback(error);\n });\n\n socket.once('data', () => {\n const secureSocket = tls.connect({\n ...configuration.tls,\n socket,\n });\n\n callback(null, secureSocket);\n });\n\n let connectMessage = '';\n\n connectMessage += 'CONNECT ' + configuration.host + ':' + configuration.port + ' HTTP/1.1\\r\\n';\n connectMessage += 'Host: ' + configuration.host + ':' + configuration.port + '\\r\\n';\n\n if (configuration.proxy.authorization) {\n connectMessage += 'Proxy-Authorization: Basic ' + Buffer.from(configuration.proxy.authorization).toString('base64') + '\\r\\n';\n }\n\n connectMessage += '\\r\\n';\n\n socket.write(connectMessage);\n }\n}\n\nexport default HttpsProxyAgent;\n"],"file":"HttpsProxyAgent.js"}
|
32
buildfiles/node_modules/global-agent/dist/classes/index.js
generated
vendored
Normal file
32
buildfiles/node_modules/global-agent/dist/classes/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Agent", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Agent.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "HttpProxyAgent", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _HttpProxyAgent.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "HttpsProxyAgent", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _HttpsProxyAgent.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Agent = _interopRequireDefault(require("./Agent"));
|
||||
|
||||
var _HttpProxyAgent = _interopRequireDefault(require("./HttpProxyAgent"));
|
||||
|
||||
var _HttpsProxyAgent = _interopRequireDefault(require("./HttpsProxyAgent"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=index.js.map
|
5
buildfiles/node_modules/global-agent/dist/classes/index.js.flow
generated
vendored
Normal file
5
buildfiles/node_modules/global-agent/dist/classes/index.js.flow
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
// @flow
|
||||
|
||||
export {default as Agent} from './Agent';
|
||||
export {default as HttpProxyAgent} from './HttpProxyAgent';
|
||||
export {default as HttpsProxyAgent} from './HttpsProxyAgent';
|
1
buildfiles/node_modules/global-agent/dist/classes/index.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/global-agent/dist/classes/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/classes/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA","sourcesContent":["// @flow\n\nexport {default as Agent} from './Agent';\nexport {default as HttpProxyAgent} from './HttpProxyAgent';\nexport {default as HttpsProxyAgent} from './HttpsProxyAgent';\n"],"file":"index.js"}
|
Reference in New Issue
Block a user