Output from http://api.drupal.org/api/function/drupal_get_headers/6 when 404 is different

Pressflow

content-type: text/html; charset=utf-8
:status: 404 Not Found

Drupal

Content-Type: text/html; charset=utf-8
HTTP/1.1 404 Not Found

Looks like I need to fix these functions

function _boost_get_http_status($default = 200) {
  static $regex = '!^HTTP/1.1\s+(\d+)!';
  return (int)_boost_get_http_header($regex, $default);
}

function _boost_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
}

NOTE: both do not say 200 when successful so the default needs to be 200.

CommentFileSizeAuthor
#2 boost-585330.patch1.82 KBmikeytown2
#1 boost-585204.patch2.71 KBmikeytown2

Comments

mikeytown2’s picture

Status: Active » Needs review
StatusFileSize
new2.71 KB
mikeytown2’s picture

StatusFileSize
new1.82 KB

Wrong issue

mikeytown2’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

crea’s picture

would be funny if you said "committed, thanks!" :-P