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.

parseProxyUrl.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _url = require("url");
  7. var _errors = require("../errors");
  8. const parseProxyUrl = url => {
  9. const urlTokens = (0, _url.parse)(url);
  10. if (urlTokens.query !== null) {
  11. throw new _errors.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.');
  12. }
  13. if (urlTokens.hash !== null) {
  14. throw new _errors.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.');
  15. }
  16. if (urlTokens.protocol !== 'http:') {
  17. throw new _errors.UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be "http:".');
  18. }
  19. let port = 80;
  20. if (urlTokens.port) {
  21. port = Number.parseInt(urlTokens.port, 10);
  22. }
  23. return {
  24. authorization: urlTokens.auth || null,
  25. hostname: urlTokens.hostname,
  26. port
  27. };
  28. };
  29. var _default = parseProxyUrl;
  30. exports.default = _default;
  31. //# sourceMappingURL=parseProxyUrl.js.map