Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
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.

37 lines
962 B

  1. 'use strict';
  2. const url = require('url');
  3. const https = require('https');
  4. /**
  5. * This currently needs to be applied to all Node.js versions
  6. * in order to determine if the `req` is an HTTP or HTTPS request.
  7. *
  8. * There is currently no PR attempting to move this property upstream.
  9. */
  10. https.request = (function(request) {
  11. return function(_options, cb) {
  12. let options;
  13. if (typeof _options === 'string') {
  14. options = url.parse(_options);
  15. } else {
  16. options = Object.assign({}, _options);
  17. }
  18. if (null == options.port) {
  19. options.port = 443;
  20. }
  21. options.secureEndpoint = true;
  22. return request.call(https, options, cb);
  23. };
  24. })(https.request);
  25. /**
  26. * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the
  27. * patched `https.request()`.
  28. *
  29. * Ref: https://github.com/nodejs/node/commit/5118f31
  30. */
  31. https.get = function(options, cb) {
  32. const req = https.request(options, cb);
  33. req.end();
  34. return req;
  35. };