]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
fix[web]: fix ignoring quality=0 values in Accept-Language
authorFlorian Best <best@univention.de>
Fri, 1 Oct 2021 22:46:07 +0000 (00:46 +0200)
committerFlorian Best <best@univention.de>
Fri, 1 Oct 2021 22:48:40 +0000 (00:48 +0200)
`Accept-Language: en-US; q=0, de-DE; q=0.5` means that english MUST not
be selected.

tornado/web.py

index b3efce998e7630a147119190ad364ffe80b8803c..8cbb2b43be35afff9b4bc9f66bc4a28443843721 100644 (file)
@@ -1293,7 +1293,8 @@ class RequestHandler(object):
                         score = 0.0
                 else:
                     score = 1.0
-                locales.append((parts[0], score))
+                if score > 0:
+                    locales.append((parts[0], score))
             if locales:
                 locales.sort(key=lambda pair: pair[1], reverse=True)
                 codes = [loc[0] for loc in locales]