[wp-hackers] XSLT: Sample implementation
Owen Winkler
ringmaster at midnightcircus.com
Mon Jan 30 23:04:11 GMT 2006
Phil Ringnalda wrote:
> 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.
This header is trivial to add.
> 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?
Do you disagree that clients should be requesting the proper content
types in their Accept header for the content that they intend to
receive? Are you really saying that this is useless because clients
will never adopt the content type recommendations that feed pundits espouse?
If a browser client prefers text/html or text/xml, and that content type
is available, shouldn't we serve that instead of application/xml or
application/atom+xml that they didn't specifically request? As far as I
see, there is plenty of latitude to assume that the request is going to
be one rendered by a browser unless requested with a specific content type.
Why should we bother? Because if you return a content type that
browsers can display to browsers that prefer it, then the browser will
also be able to render it in addition to whatever other clients request
it. Not doing this gets us nothing. Doing this makes the content at
the other end of feeds appear more friendly, which has yet to be
demonstrated to harm anyone.
And regarding caching - How does the content type affect caching at all
beyond the small change to add the Vary header?
We spent a good bit of time thinking about, discussing, and coding this
solution. It's going to take more of an explanation than saying "why
bother?" and complete lack of an alternative to convince me that this
isn't worth doing.
Owen
More information about the wp-hackers
mailing list