Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HttpsProxyAgent.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _net = _interopRequireDefault(require("net"));
  7. var _tls = _interopRequireDefault(require("tls"));
  8. var _Agent = _interopRequireDefault(require("./Agent"));
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. class HttpsProxyAgent extends _Agent.default {
  11. // eslint-disable-next-line unicorn/prevent-abbreviations
  12. constructor(...args) {
  13. super(...args);
  14. this.protocol = 'https:';
  15. this.defaultPort = 443;
  16. }
  17. createConnection(configuration, callback) {
  18. const socket = _net.default.connect(configuration.proxy.port, configuration.proxy.hostname);
  19. socket.on('error', error => {
  20. callback(error);
  21. });
  22. socket.once('data', () => {
  23. const secureSocket = _tls.default.connect({ ...configuration.tls,
  24. socket
  25. });
  26. callback(null, secureSocket);
  27. });
  28. let connectMessage = '';
  29. connectMessage += 'CONNECT ' + configuration.host + ':' + configuration.port + ' HTTP/1.1\r\n';
  30. connectMessage += 'Host: ' + configuration.host + ':' + configuration.port + '\r\n';
  31. if (configuration.proxy.authorization) {
  32. connectMessage += 'Proxy-Authorization: Basic ' + Buffer.from(configuration.proxy.authorization).toString('base64') + '\r\n';
  33. }
  34. connectMessage += '\r\n';
  35. socket.write(connectMessage);
  36. }
  37. }
  38. var _default = HttpsProxyAgent;
  39. exports.default = _default;
  40. //# sourceMappingURL=HttpsProxyAgent.js.map