Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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):

Canonical link: https://commits.webkit.org/135861@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
elecro authored and webkit-commit-queue committed Jun 18, 2013
1 parent 5d97a49 commit 35a9f30
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
2013-06-17 Peter Gal <galpeter@inf.u-szeged.hu>

[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 <bfulgham@apple.com>

AX: Correct accessibility role when -webkit-box:display is used.
Expand Down
19 changes: 19 additions & 0 deletions Source/WebCore/platform/network/curl/ResourceHandleManager.cpp
Expand Up @@ -366,6 +366,25 @@ static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data)
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());
}

}
}

Expand Down

0 comments on commit 35a9f30

Please sign in to comment.