Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16322 closed Bug (fixed)

Some mobile Accept-Language headers are not parsed

Reported by: Max Arnold <lwarxx@…> Owned by: nobody
Component: Internationalization Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Some mobile phones use spaces before or after semicolon in Accept-Language header. Django can't parse such headers:

"Accept-Language: en; q=1.0, *; q=0.5"
"Accept-Language: ru-ru,*; q=0.5"
>>> parse_accept_lang_header('en; q=1.0, *; q=0.5')
>>> []

More examples here: http://stackoverflow.com/questions/377864/detect-mobile-supported-languages

Another confirmation: https://www-304.ibm.com/support/docview.wss?uid=swg1PK98260&wv=1

According to RFC 2616, there should be no whitespaces, but RFC 3282 allows CFWS and also I found this proposal http://lists.w3.org/Archives/Public/ietf-http-wg/2009OctDec/0177.html where OWS is explicitly mentioned.

Attachments (1)

allow-spaces-in-accept-language.diff (1.7 KB ) - added by Max Arnold <lwarxx@…> 13 years ago.
patch with tests

Download all attachments as: .zip

Change History (5)

comment:1 by Aymeric Augustin, 13 years ago

Easy pickings: set
Needs tests: set
Triage Stage: UnreviewedAccepted

by Max Arnold <lwarxx@…>, 13 years ago

patch with tests

comment:2 by mark.smith@…, 13 years ago

Has patch: set
Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:3 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [16457]:

Fixed #16322 -- Fixed Accept-Language parsing to allow spaces around semicolons. Thanks, Max Arnold.

comment:4 by anonymous, 13 years ago

Thank you too!

Note: See TracTickets for help on using tickets.
Back to Top