You are here

function _authcache_get_http_header in Authenticated User Page Caching (Authcache) 6

2 calls to _authcache_get_http_header()
_authcache_get_content_type in ./authcache.helpers.inc
Determines the MIME content type of the current page response based on the currently set Content-Type HTTP header.
_authcache_get_http_status in ./authcache.helpers.inc
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

./authcache.helpers.inc, line 377
Helper functions for the Authcache module (no Drupal hooks here).

Code

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

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

    // found it
  }
  return $default;

  // no such luck
}