Pingback on February 21st, 2007.
[…] 6: On a related note, I tried Reiner Saddey’s fix for getting WP-Cache to remember the content-type on feeds, but it had the same problem my fix did, […]
Comment on February 21st, 2007.
I promise to have in depth look into the 304 Not Modified till the end of next week. I just love Ricardo’s WP-Cache plugin, it’s well structured and I don’t think that it will be very hard to have it generate the proper 304 response.
Pingback on April 10th, 2007.
[…] working on the 304 not modified case that causes excessive traffic for RSS feeds, I encountered a mild weakness within the compression code, that causes both gzip and x-gzip […]
Pingback on April 29th, 2007.
[…] [Nachtrag] Nicht ganz Scotty, aber der hier kommt verdammt nah dran: How to prevent WP-Cache from changing a Feed’s content-type… […]
Comment on April 29th, 2007.
Your fix didn’t work for me, but pointed me to the right direction ![]()
wp-cache-phase2.php, line 230ff:
if (!$response{’Content-Type’}) {
$value = “text/html; charset=\”" . get_settings(’blog_charset’) . “\”";
@header(”Content-Type: $value”);
array_push($wp_cache_meta_object->headers, “Content-Type: $value”);
}
checks for “Content-Type”
BUT
wp-rss2.php sets the content-type header like this:
“Content-type”
So the check fails, resulting in the text/html content-type inserted by wp-cache.
Simply change “Content-type” to “Content-Type” in wp-rss2.php
on line 8:
header(’Content-Type: text/xml; charset=’ . get_option(’blog_charset’), true);
fixed the problem for me.
Comment on April 29th, 2007.
Thanks Webrocker. Yes, I ran into that one as well, but ígnored it for the time beeing, falsely assuming, that all of WP code would use consistent casing.
The ultimate cause for this problem is, that according to HTTP specs, HTTP headers must be interpreted ignoring case. So Content-Type and Content-type are both valid headers, but the current wp-cache code compares them using “proper” case.
I’m terribly late doing the 304 thing (i.e. conditional get) ![]()
Comment on April 29th, 2007.
it’s better to change the check in wp-cache-phase2.php than to change Wordpress-Core files:
if (!$response{’Content-Type’} && !$response{’Content-type’} && !$response{’content-type’}) {
$value = “text/html; charset=\”” . get_settings(’blog_charset’) . “\””;
@header(”Content-Type: $value”);
array_push($wp_cache_meta_object->headers, “Content-Type: $value”);
}
Comment on April 30th, 2007.
Hi again,
I changed the if-loop rather, uhm, unelegantly:
if (
!$response{’Content-Type’} &&
!$response{’Content-type’} &&
!$response{’content-type’} &&
!$response{’CONTENT-TYPE’}
) { … }
and now it works for my setup. I’m not very skilled with PHP, so maybe
there’s a better way to ‘check’ for the ‘content-type’
case-insensitive? Same would be true for the other if-loops, like
‘creation-date’ and such…
What is the problem with the ‘conditional-get’ thing?
If I look at the headers being sent (with the ‘LiveHTTPHeaders’
Extension for Firefox), I see 200 and 304 states, but I haven’t figured
out which one is the correct one…?
Thanks for your work and time,
Tom
Comment on May 5th, 2007.
Thanks for spotting and reporting this. I want to add there is still a problem for me even with wp-cache 2.1.1 + php 4.4.6 with the special condition of LiteSpeed replacing Apache.
I suspect it’s a bug in how apache_response_headers() hooks back into LiteSpeed’s emulation which I will report to them. But you saved me a shedload of time tracking down the likely issue, very grateful.
Comment on May 29th, 2007.
Very interesting topic, I personally just modified wp-rss2.php, but couldn’t you also just tell wp-cache not to cache wp-rss in the settings? If you did that you could just implement server-side Caching with apache.
Pingback on November 6th, 2007.
[…] recompressed for each request). Very interested in what Donncha thinks about this. Also included Reiner Saddey’s fix to prevent WP-Cache from changing the content type of feeds to […]
Pingback on November 6th, 2007.
[…] all the bugs mentioned below are now fixed. I applied Tummbler’s patch (from Elliott and Reiner) that enables gzip compression of the WP-Cache data files and fixes feed content […]
Pingback on November 6th, 2007.
[…] Tummbler’s patch (from Elliott and Reiner) that enables gzip compression of the WP-Cache data files and fixes feed content types.Please note: […]
Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.