Make WordPress Core


Ignore:
Timestamp:
06/09/2005 12:17:43 AM (20 years ago)
Author:
matt
Message:

Better headers for CGI enviroments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-blog-header.php

    r2600 r2623  
    108108
    109109// Sending HTTP headers
     110@header('X-Pingback: '. get_bloginfo('pingback_url'));
    110111
    111112if ( !empty($error) && '404' == $error ) {
    112     if ( preg_match('/cgi/', php_sapi_name()) )
    113         @header('Status: 404 Not Found');
    114     else
    115         @header('HTTP/1.x 404 Not Found');
     113    status_header( 404 );
    116114 } else if ( empty($feed) ) {
    117     @header('X-Pingback: '. get_bloginfo('pingback_url'));
    118115    @header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    119116} else {
     
    126123    @header("Last-Modified: $wp_last_modified");
    127124    @header("ETag: $wp_etag");
    128     @header('X-Pingback: ' . get_bloginfo('pingback_url'));
    129125
    130126    // Support for Conditional GET
     
    142138        (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
    143139        (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
    144         if ( preg_match('/cgi/',php_sapi_name()) ) {
    145             header('Status: 304 Not Modified');
    146             echo "\r\n\r\n";
    147             exit;
    148         } else {
    149             if ( version_compare(phpversion(), '4.3.0', '>=') )
    150                 header('Not Modified', TRUE, 304);
    151             else
    152                 header('HTTP/1.x 304 Not Modified');
    153             exit;
    154         }
     140        status_header( 304 );
     141        exit;
    155142    }
    156143}
     
    192179        (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
    193180    $wp_query->is_404 = true;
    194     if ( preg_match('/cgi/', php_sapi_name()) )
    195         @header('Status: 404 Not Found');
    196     else
    197         @header('HTTP/1.x 404 Not Found');
     181    status_header( 404 );
     182} else {
     183    status_header( 200 );
    198184}
    199185
Note: See TracChangeset for help on using the changeset viewer.