Fixing Batcache to Send The Correct Content-Type Header
I’m a fan of Batcache, the Memcached-based WordPress full-page cache solution, but I’ve discovered that it ignores the content-type header set when the page is initially generated and re-sends all content with content-type: text/html. I posted a note about this at the WordPress support forums, but then I realized what the problem was: apache_response_headers() doesn’t return the content type, but headers_list() does.
The solution is to replace apache_response_headers() with headers_list() in the code, though headers_list() is PHP 5+ only, so it might be a while before we see a change like this committed. Still, I’ll shamelessly tag Andy Skelton (Batcache’s author) on it.
3 Comments
Comments RSS TrackBack Identifier URI
Leave a comment
It’s a shame we can’t rely on PHP knowing the headers sent. That’s why I added the status_header filter. Unfortunately WordPress doesn’t have a similar function for all headers. If you want to patch with a function_exists check, I’ll commit it.
@Andy Skelton: Will do.
[...] Casey Bisson for describing the content-type patch for Batcache [...]