Changeset 151668 in webkit


Ignore:
Timestamp:
Jun 17, 2013 11:09:40 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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

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

No new tests, covered by existing ones.

  • platform/network/curl/ResourceHandleManager.cpp:

(WebCore::headerCallback):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151665 r151668  
     12013-06-17  Peter Gal  <galpeter@inf.u-szeged.hu>
     2
     3        [curl] Set the http response status text
     4        https://bugs.webkit.org/show_bug.cgi?id=117307
     5
     6        Reviewed by Brent Fulgham.
     7
     8        No new tests, covered by existing ones.
     9
     10        * platform/network/curl/ResourceHandleManager.cpp:
     11        (WebCore::headerCallback):
     12
    1132013-06-14  Brent Fulgham  <bfulgham@apple.com>
    214
  • trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp

    r151580 r151668  
    367367            else
    368368                d->m_response.setHTTPHeaderField(key, value);
     369        } else if (header.startsWith("HTTP", false)) {
     370            // This is the first line of the response.
     371            // Extract the http status text from this.
     372            //
     373            // If the FOLLOWLOCATION option is enabled for the curl handle then
     374            // curl will follow the redirections internally. Thus this header callback
     375            // will be called more than one time with the line starting "HTTP" for one job.
     376            long httpCode = 0;
     377            curl_easy_getinfo(d->m_handle, CURLINFO_RESPONSE_CODE, &httpCode);
     378
     379            String httpCodeString = String::number(httpCode);
     380            int statusCodePos = header.find(httpCodeString);
     381
     382            if (statusCodePos != -1) {
     383                // The status text is after the status code.
     384                String status = header.substring(statusCodePos + httpCodeString.length());
     385                d->m_response.setHTTPStatusText(status.stripWhiteSpace());
     386            }
     387
    369388        }
    370389    }
Note: See TracChangeset for help on using the changeset viewer.