diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 23:14:25 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 23:14:25 +0000 |
commit | 88e6b6f3251af7092432c33b7d372a17c7169904 (patch) | |
tree | 3fde374eed02ee05026449729952f0364609971b /webkit | |
parent | da244100d3ac663a1f827fc712dc508c7761d207 (diff) | |
download | chromium_src-88e6b6f3251af7092432c33b7d372a17c7169904.zip chromium_src-88e6b6f3251af7092432c33b7d372a17c7169904.tar.gz chromium_src-88e6b6f3251af7092432c33b7d372a17c7169904.tar.bz2 |
Pass HttpRequestHeaders to URLRequest::SetExtraRequestHeaders().
BUG=22588
Review URL: http://codereview.chromium.org/1998008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 15 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_resource_loader_bridge.cc | 5 |
2 files changed, 11 insertions, 9 deletions
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index fb2fad1..dd2c79e 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -10,6 +10,7 @@ #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" +#include "net/http/http_request_headers.h" #include "webkit/appcache/appcache_group.h" #include "webkit/appcache/appcache_policy.h" #include "webkit/appcache/appcache_response.h" @@ -274,15 +275,15 @@ void AppCacheUpdateJob::AddHttpHeadersAndFetch( URLRequest* request, const net::HttpResponseInfo* info) { DCHECK(request); if (info) { - std::string extra_headers; + net::HttpRequestHeaders extra_headers; // Add If-Modified-Since header if response info has Last-Modified header. const std::string last_modified = "Last-Modified"; std::string last_modified_value; info->headers->EnumerateHeader(NULL, last_modified, &last_modified_value); if (!last_modified_value.empty()) { - extra_headers.append("If-Modified-Since: "); - extra_headers.append(last_modified_value); + extra_headers.SetHeader(net::HttpRequestHeaders::kIfModifiedSince, + last_modified_value); } // Add If-None-Match header if resposne info has ETag header. @@ -290,13 +291,11 @@ void AppCacheUpdateJob::AddHttpHeadersAndFetch( std::string etag_value; info->headers->EnumerateHeader(NULL, etag, &etag_value); if (!etag_value.empty()) { - if (!extra_headers.empty()) - extra_headers.append("\r\n"); - extra_headers.append("If-None-Match: "); - extra_headers.append(etag_value); + extra_headers.SetHeader(net::HttpRequestHeaders::kIfNoneMatch, + etag_value); } - if (!extra_headers.empty()) + if (!extra_headers.IsEmpty()) request->SetExtraRequestHeaders(extra_headers); } request->Start(); diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 5cfbea0..690f169 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -44,6 +44,7 @@ #include "net/base/net_util.h" #include "net/base/static_cookie_policy.h" #include "net/base/upload_data.h" +#include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request.h" @@ -215,7 +216,9 @@ class RequestProxy : public URLRequest::Delegate, request_->set_method(params->method); request_->set_first_party_for_cookies(params->first_party_for_cookies); request_->set_referrer(params->referrer.spec()); - request_->SetExtraRequestHeaders(params->headers); + net::HttpRequestHeaders headers; + headers.AddHeadersFromString(params->headers); + request_->SetExtraRequestHeaders(headers); request_->set_load_flags(params->load_flags); request_->set_upload(params->upload.get()); request_->set_context(request_context); |