Skip to content

Commit

Permalink
Don't flush as it breaks the output buffer.
Browse files Browse the repository at this point in the history
Fixes #126, get headers from headers_list() if apache_response_headers()
fails.
  • Loading branch information
donnchawp committed Feb 9, 2017
1 parent 02e12ce commit 628fd31
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions wp-cache-phase2.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,22 @@ function wp_cache_user_agent_is_rejected() {
}

function wp_cache_get_response_headers() {
if(function_exists('apache_response_headers')) {
$headers = array();
if ( function_exists( 'apache_response_headers' ) ) {
$headers = apache_response_headers();
if ( empty( $headers ) ) {
flush();
$headers = apache_response_headers();
}
} else if(function_exists('headers_list')) {
}
if ( empty( $headers ) && function_exists( 'headers_list' ) ) {
$headers = array();
foreach(headers_list() as $hdr) {
foreach( headers_list() as $hdr ) {
$header_parts = explode( ':', $hdr, 2 );
$header_name = isset( $header_parts[0] ) ? trim( $header_parts[0] ) : '';
$header_value = isset( $header_parts[1] ) ? trim( $header_parts[1] ) : '';

$headers[$header_name] = $header_value;
}
} else
} else {
$headers = null;
}

return $headers;
}
Expand Down

0 comments on commit 628fd31

Please sign in to comment.