You are here

function _boost_get_http_header in Boost 5

2 calls to _boost_get_http_header()
_boost_get_content_type in ./boost.module
Determines the MIME content type of the current page response based on the currently set Content-Type HTTP header.
_boost_get_http_status in ./boost.module
Determines the HTTP response code that the current page request will be returning by examining the HTTP headers that have been output so far.

File

./boost.module, line 339
Provides static page caching for Drupal.

Code

function _boost_get_http_header($regex, $default = NULL) {

  // The last header is the one that counts:
  $headers = preg_grep($regex, explode("\n", drupal_set_header()));
  if (!empty($headers) && preg_match($regex, array_pop($headers), $matches)) {
    return $matches[1];

    // found it
  }
  return $default;

  // no such luck
}