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.

calculate-server-name.js 599B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. const net = require('net');
  3. /* istanbul ignore file: https://github.com/nodejs/node/blob/v13.0.1/lib/_http_agent.js */
  4. module.exports = options => {
  5. let servername = options.host;
  6. const hostHeader = options.headers && options.headers.host;
  7. if (hostHeader) {
  8. if (hostHeader.startsWith('[')) {
  9. const index = hostHeader.indexOf(']');
  10. if (index === -1) {
  11. servername = hostHeader;
  12. } else {
  13. servername = hostHeader.slice(1, -1);
  14. }
  15. } else {
  16. servername = hostHeader.split(':', 1)[0];
  17. }
  18. }
  19. if (net.isIP(servername)) {
  20. return '';
  21. }
  22. return servername;
  23. };