Accept-Language is missing in Vary header when it's used to find out user's preferred variant
Closed, ResolvedPublic


Add Accept-Language to Vary header

It can cause some problems when responses are cached by squid etc.

Version: 1.16.x
Severity: normal

attachment vary.diff ignored as obsolete

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz21672.
liangent created this task.Via LegacyNov 28 2009, 5:33 PM
Catrope added a comment.Via ConduitNov 28 2009, 5:48 PM

Why did you change the case in Accept-Encoding to accept-encoding (same for Cookie)? I'm not sure if these headers are case-sensitive, but it's best to leave them in their current case. Also, for this to work, OutputPage::getXVO() would have to be changed. Finally, the idea of adding this option inside LanguageConverter doesn't look optimal to me, but I'm not familiar enough with this code to come up with a better idea offhand.

liangent added a comment.Via ConduitNov 28 2009, 5:54 PM

HTTP header names seem to be case-insensitive ( see ). I changed the case to avoid duplicates. XVO is not a part of HTTP standard, and I know nothing about it... Is it required?

Catrope added a comment.Via ConduitNov 28 2009, 6:34 PM

XVO stands for X-Vary-Options: , which is a header Squid uses to determine if something is cacheable. However, I don't believe caching multiple versions of the same page and choosing the one to serve based on a header (like Accept-Language) is possible at the moment.

bzimport added a comment.Via ConduitNov 28 2009, 8:03 PM

PhiLiP.NPC wrote:

I have commit this patch to svn with a few changes have been made:

  1. Change the lowercase accept-encoding back to Accept-Encoding.
  2. Change getXVO() to include the Accept-Language header, base on Tim Starling's note on
  3. Only add Accept-Language when a valid variant has been found out. In zh case, it's about 7 variants.

If I did something wrong, please tell me.

bzimport added a comment.Via ConduitNov 28 2009, 8:04 PM

PhiLiP.NPC wrote:

Oops, about 8 variants: zh-hans, zh-hant, zh-cn, zh-hk, zh-mo, zh-my, zh-sg, zh-tw. But only zh-cn, zh-hk, zh-tw are commonly used.

bzimport added a comment.Via ConduitNov 28 2009, 8:05 PM

PhiLiP.NPC wrote:

Forgot to include rev id: r59522, r59523, and r59527.

liangent added a comment.Via ConduitNov 29 2009, 7:19 AM

Created attachment 6832
Add all available variants to Accept-Language in XVO

I don't agree with r59541 (a follow-up) about what the content in X-Vary-Options should be. See my comment there.

Here is my patch. A new way to add stuff to these headers is provided.

I can't find anything about what if no *-contains exists with a single header name...

Attached: xvo.diff

bzimport added a comment.Via ConduitNov 10 2011, 12:18 AM

sumanah wrote:


bzimport added a comment.Via ConduitApr 17 2012, 3:49 PM

sumanah wrote:

Liangent, I'm sorry, but over time trunk has changed such that your patch no longer applies. If this issue is still a problem, can you update your patch and submit it in Gerrit? Thanks.

liangent added a comment.Via ConduitNov 17 2012, 5:04 PM

A similar implementation is already in codebase. Dunno when it was added.

Add Comment