[curl] Headers should be parsed as utf8 if possible
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jun 2013 03:58:39 +0000 (03:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jun 2013 03:58:39 +0000 (03:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117196

Patch by Peter Gal <galpeter@inf.u-szeged.hu> on 2013-06-04
Reviewed by Brent Fulgham.

Testcase already present: http/tests/download/literal-utf-8.html

* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::headerCallback): Parse the header as an utf8 string if possible.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/curl/ResourceHandleManager.cpp

index bc54dcd..be8be77 100644 (file)
@@ -1,3 +1,15 @@
+2013-06-04  Peter Gal  <galpeter@inf.u-szeged.hu>
+
+        [curl] Headers should be parsed as utf8 if possible
+        https://bugs.webkit.org/show_bug.cgi?id=117196
+
+        Reviewed by Brent Fulgham.
+
+        Testcase already present: http/tests/download/literal-utf-8.html
+
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::headerCallback): Parse the header as an utf8 string if possible.
+
 2013-06-04  Oliver Hunt  <oliver@apple.com>
 
         Prevent throttling while resources are being loaded
index c08f204..257b570 100644 (file)
@@ -257,7 +257,7 @@ static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data)
     size_t totalSize = size * nmemb;
     ResourceHandleClient* client = d->client();
 
-    String header(static_cast<const char*>(ptr), totalSize);
+    String header = String::fromUTF8WithLatin1Fallback(static_cast<const char*>(ptr), totalSize);
 
     /*
      * a) We can finish and send the ResourceResponse