diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-20 14:59:44 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-20 14:59:44 +0000 |
commit | 5f9a7f97780db19175a8549d39b97f62fa6c9afb (patch) | |
tree | 3fd95826f8b36779fe1394b36a0f0814ecc6eeb5 /net | |
parent | 00f1cab12265fc810d882ae20e58bdef9437ca7f (diff) | |
download | chromium_src-5f9a7f97780db19175a8549d39b97f62fa6c9afb.zip chromium_src-5f9a7f97780db19175a8549d39b97f62fa6c9afb.tar.gz chromium_src-5f9a7f97780db19175a8549d39b97f62fa6c9afb.tar.bz2 |
Remove support for filtering by MIME-type.
Also merge kDontSendCookies and kDontStoreCookies to kNoCookies.
BUG=16932
TEST=unit_tests
Review URL: http://codereview.chromium.org/542056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request_context.h | 15 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.cc | 8 |
2 files changed, 12 insertions, 11 deletions
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 5eac06e..b0204ce 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -105,16 +105,17 @@ class URLRequestContext : referrer_charset_ = charset; } - // Called for each cookie returning for the given request. A pointer to - // the cookie is passed so that it can be modified. Returns true if the - // cookie was not dropped (it could still be modified though). - virtual bool InterceptCookie(const URLRequest* request, std::string* cookie) { + // Called before adding cookies to requests. Returns true if cookie can + // be added to the request. The cookie might still be modified though. + virtual bool InterceptRequestCookies(const URLRequest* request, + const std::string& cookies) const { return true; } - // Called before adding cookies to sent requests. Allows overriding - // requests to block sending of cookies. - virtual bool AllowSendingCookies(const URLRequest* request) const { + // Called before adding cookies from respones to the cookie monster. Returns + // true if the cookie can be added. The cookie might still be modified though. + virtual bool InterceptResponseCookie(const URLRequest* request, + const std::string& cookie) const { return true; } diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 93f6b5b..4b665be 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -647,8 +647,7 @@ void URLRequestHttpJob::AddExtraHeaders() { URLRequestContext* context = request_->context(); if (context) { - if (context->AllowSendingCookies(request_)) - request_info_.extra_headers += AssembleRequestCookies(); + request_info_.extra_headers += AssembleRequestCookies(); // Only add default Accept-Language and Accept-Charset if the request // didn't have them specified. @@ -675,7 +674,8 @@ std::string URLRequestHttpJob::AssembleRequestCookies() { options.set_include_httponly(); std::string cookies = request_->context()->cookie_store()-> GetCookiesWithOptions(request_->url(), options); - if (!cookies.empty()) + if (context->InterceptRequestCookies(request_, cookies) && + !cookies.empty()) return "Cookie: " + cookies + "\r\n"; } } @@ -691,7 +691,7 @@ void URLRequestHttpJob::FetchResponseCookies() { void* iter = NULL; while (response_info_->headers->EnumerateHeader(&iter, name, &value)) - if (request_->context()->InterceptCookie(request_, &value)) + if (request_->context()->InterceptResponseCookie(request_, value)) response_cookies_.push_back(value); } |