[wp-hackers] XSLT: Sample implementation

Phil Ringnalda philringnalda at gmail.com
Mon Jan 30 22:22:37 GMT 2006


Matt Read wrote:
> Here's a diff for wp-atom.php to do just such that. Sends text/xml if the 
> user-agent doesn't accept application/atom+xml.

If what you return varies based on the Accept header, then your response 
needs to include a "Vary: Accept" header, so that a cache with one 
version doesn't return it to something which would get the other 
version. At which point, from what I've heard, most caches will just 
punt and not cache it at all, rather than worry about handling the Vary.

And since the purpose of mime-types is to tell general-purpose user 
agents how to handle or dispatch an unusual content type, and you know 
that the general-purpose user agents aren't going to add 
application/atom+xml to their Accept header even if they know how to 
dispatch it, while the specific-purpose user agents that will add it 
will do the exact same thing no matter what type you return (possibly 
short of text/html), why bother? If you would rather work around browser 
bugs than work with the architecture of the web, just embrace that 
desire, and send application/xml (please, not text/xml, which has a rare 
but still very real risk of arriving misencoded) to everything. Caching 
(and minimizing the amount of processing required to generate a feed) is 
vastly more valuable than sending the correct mime-type only to things 
that you know will ignore it.

Phil Ringnalda


More information about the wp-hackers mailing list