You are here

function httprl_get_hostname in HTTP Parallel Request & Threading Library 7

Same name and namespace in other branches
  1. 6 httprl.module \httprl_get_hostname()

Get hostname of this server.

Return value

string hostname or empty string; does not contain the port number.

4 calls to httprl_get_hostname()
httprl_install_http_test in ./httprl.install
Issue a HTTP request to admin/httprl-test, verifying that the server got it.
httprl_parse_data in ./httprl.module
Extract the header and meta data from the http data stream.
httprl_queue_background_callback in ./httprl.module
Run callback in the background.
_httprl_build_drupal_root in ./httprl.module
Helper function to build an URL for asynchronous requests to self.

File

./httprl.module, line 3795
HTTP Parallel Request Library module.

Code

function httprl_get_hostname() {
  if (!empty($_SERVER['HTTP_HOST'])) {

    // If HTTP_HOST contains the port, use SERVER_NAME.
    if (strpos($_SERVER['HTTP_HOST'], ':') !== FALSE) {
      return $_SERVER['SERVER_NAME'];
    }
    return $_SERVER['HTTP_HOST'];
  }
  elseif (!empty($_SERVER['SERVER_NAME'])) {
    return $_SERVER['SERVER_NAME'];
  }
  return '';
}