'use strict';

var http = require('http');

/**
 *@module Request
*/
Object.defineProperties(http.IncomingMessage.prototype, {
  /**
   *@type {boolean}
   *@memberof Request#
  */
  isHttps: {
    configurable: true,

    get() {
      return this.connection.encrypted;
    }

  },

  /**
   *@type {string}
   *@memberof Request#
  */
  hostname: {
    configurable: true,

    get() {
      const host = this.headers['host'];
      return typeof host === 'string' ? host.replace(/:\d+$/, '') : '';
    }

  }
});

module.exports = http.IncomingMessage;
