[SOUP] Make Accept-Languages header look more like other browsers
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2018 19:43:59 +0000 (19:43 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2018 19:43:59 +0000 (19:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191614

Reviewed by Carlos Garcia Campos.

This changes our Accept-Language header to better match other browsers, from something
like this:

Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70

to something like this:

Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70

There's no particular motivation for this change. I just noticed we were different for no
clear reason.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::buildAcceptLanguages):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_set_preferred_languages):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238236 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp

index 6f23936..8664787 100644 (file)
@@ -1,3 +1,27 @@
+2018-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [SOUP] Make Accept-Languages header look more like other browsers
+        https://bugs.webkit.org/show_bug.cgi?id=191614
+
+        Reviewed by Carlos Garcia Campos.
+
+        This changes our Accept-Language header to better match other browsers, from something
+        like this:
+
+        Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70
+
+        to something like this:
+
+        Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70
+
+        There's no particular motivation for this change. I just noticed we were different for no
+        clear reason.
+
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::buildAcceptLanguages):
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkit_web_context_set_preferred_languages):
+
 2018-11-15  Daniel Bates  <dabates@apple.com>
 
         [iOS] Shift + Tab does not focus previous field
index 59bfe28..d90c73e 100644 (file)
@@ -76,7 +76,7 @@ static CString buildAcceptLanguages(const Vector<String>& languages)
             continue;
 
         if (i)
-            builder.appendLiteral(", ");
+            builder.appendLiteral(",");
 
         builder.append(languages[i]);
 
index 32ce06c..39f3c08 100644 (file)
@@ -1312,9 +1312,9 @@ void webkit_web_context_set_preferred_languages(WebKitWebContext* context, const
     for (size_t i = 0; languageList[i]; ++i) {
         // Do not propagate the C locale to WebCore.
         if (!g_ascii_strcasecmp(languageList[i], "C") || !g_ascii_strcasecmp(languageList[i], "POSIX"))
-            languages.append("en-us"_s);
+            languages.append("en-US"_s);
         else
-            languages.append(String::fromUTF8(languageList[i]).convertToASCIILowercase().replace("_", "-"));
+            languages.append(String::fromUTF8(languageList[i]).replace("_", "-"));
     }
     overrideUserPreferredLanguages(languages);
 }