Re: [PATCH v3] http: Add Accept-Language header if possible
- From
Yi, EungJun <semtlenori@gmail.com>
- Date
- Jul 12, 2014, 18:52 UTC
- Message-ID
- <CAFT+Tg8HfoFO8T+EJ6DiMj6kRO8h0P7tO2PHTK9BFMMe+Ld_Vg@mail.gmail.com>
- In-Reply-To
- <20140711173544.GB7856@sigill.intra.peff.net>
Thanks for your detailed review and nice suggestions. I will accept most of them.
2014-07-12 2:35 GMT+09:00 Jeff King <peff@peff.net>:
Show 12 quoted lines
>> + /* Decide the precision for q-factor on number of preferred languages. */
>> + if (num_langs + 1 > 100) { /* +1 is for '*' */
>> + q_precision = 0.001;
>> + q_format = "; q=%.3f";
>> + } else if (num_langs + 1 > 10) { /* +1 is for '*' */
>> + q_precision = 0.01;
>> + q_format = "; q=%.2f";
>> + }
>
> I don't mind this auto-precision too much, but I'm not sure it buys us
> anything. We are still setting a hard-limit at 100, and it just means we
> write "0.1" instead of "0.001" sometimes.It means we use "0.1" if possible.
>From my observation, many major web browsers doesn't or didn't send
q-factor of 2 or 3 decimal places. Google chrome doesn't currently and Mozilla firefox also didn't before 2012 [1]. I think it means some old and naive web servers may not support q-factor of 2 or 3 decimal places because major web browsers don't send it. So I think we should use "0.1" if possible for interoperability with the buggy servers.
But, quite frankly, it is just a possibility and I have no evidence which proves that such kind of buggy servers really exist. Please let me know if anybody know about it.
[1]: http://hg.mozilla.org/integration/mozilla-inbound/rev/b0b07ef904ea