Make WordPress Core

Opened 15 years ago

Last modified 12 years ago

#3528 closed defect (bug)

HTTP 304 status not sent correctly on PHP 5.2, breaking conditional GET on feeds — at Initial Version

Reported by: kelson Owned by:
Milestone: 2.0.7 Priority: high
Severity: major Version: 2.0.6
Component: General Keywords:
Focuses: Cc:

Description

After upgrading to WordPress 2.0.6, I noticed that my feeds were no longer working. In several browsers and readers, including Firefox, IE7, Konqueror and Akregator, only blank files were being sent. Server logs indicated a 200 response with a few hundred bytes, but browsers showed only an empty file. Oddly, Opera, Dillo, and command-line GET displayed the files fine.

Looking at the actual HTTP response headers, it turned out that on conditional GETs that were supposed to issue 304 Not Modified, the server was actually issuing the following:

HTTP/1.1 200 OK
(other headers)
Status: 304 Not Modified

This resulted in a 200 OK status and empty response body.

I looked through and found that the status was being set in wp-includes/functions.php, in the status_header function. I changed the following line:

@header("Status: $header $text");

to this:

@header("Status: $header $text", TRUE, $header);

After making that change, status headers were sent correctly. Once I cleared the browser cache, feeds started loading again.

Going by the recommended method in the PHP manual, I also tried commenting out the if statement regarding the PHP API, so that only the following statement would run:

@header("HTTP/1.1 $header $text");

This also worked correctly.

This is with PHP 5.2.0 on Apache 1.3.37 (yes, I do intend to upgrade it eventually) using the mod_php interface.

Write-up at http://www.hyperborea.org/journal/archives/2007/01/05/feed-problems/

Change History (0)

Note: See TracTickets for help on using tickets.