Title: [151668] trunk/Source/WebCore
Revision
151668
Author
[email protected]
Date
2013-06-17 23:09:40 -0700 (Mon, 17 Jun 2013)

Log Message

[curl] Set the http response status text
https://bugs.webkit.org/show_bug.cgi?id=117307

Patch by Peter Gal <[email protected]> on 2013-06-17
Reviewed by Brent Fulgham.

No new tests, covered by existing ones.

* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::headerCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151667 => 151668)


--- trunk/Source/WebCore/ChangeLog	2013-06-18 05:59:33 UTC (rev 151667)
+++ trunk/Source/WebCore/ChangeLog	2013-06-18 06:09:40 UTC (rev 151668)
@@ -1,3 +1,15 @@
+2013-06-17  Peter Gal  <[email protected]>
+
+        [curl] Set the http response status text
+        https://bugs.webkit.org/show_bug.cgi?id=117307
+
+        Reviewed by Brent Fulgham.
+
+        No new tests, covered by existing ones.
+
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::headerCallback):
+
 2013-06-14  Brent Fulgham  <[email protected]>
 
         AX: Correct accessibility role when -webkit-box:display is used.

Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp (151667 => 151668)


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2013-06-18 05:59:33 UTC (rev 151667)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp	2013-06-18 06:09:40 UTC (rev 151668)
@@ -366,6 +366,25 @@
                 d->m_response.addHTTPHeaderField(key, value);
             else
                 d->m_response.setHTTPHeaderField(key, value);
+        } else if (header.startsWith("HTTP", false)) {
+            // This is the first line of the response.
+            // Extract the http status text from this.
+            //
+            // If the FOLLOWLOCATION option is enabled for the curl handle then
+            // curl will follow the redirections internally. Thus this header callback
+            // will be called more than one time with the line starting "HTTP" for one job.
+            long httpCode = 0;
+            curl_easy_getinfo(d->m_handle, CURLINFO_RESPONSE_CODE, &httpCode);
+
+            String httpCodeString = String::number(httpCode);
+            int statusCodePos = header.find(httpCodeString);
+
+            if (statusCodePos != -1) {
+                // The status text is after the status code.
+                String status = header.substring(statusCodePos + httpCodeString.length());
+                d->m_response.setHTTPStatusText(status.stripWhiteSpace());
+            }
+
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to