diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 00:20:08 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 00:20:08 +0000 |
commit | fa0cf1acdde214ff05aac75d182210445d8242f8 (patch) | |
tree | d110673bed8ce96925951b1e43f42ccf0527e8f7 /chrome/browser | |
parent | 8e8817a36fff169cf3767462717c2321b30fa2af (diff) | |
download | chromium_src-fa0cf1acdde214ff05aac75d182210445d8242f8.zip chromium_src-fa0cf1acdde214ff05aac75d182210445d8242f8.tar.gz chromium_src-fa0cf1acdde214ff05aac75d182210445d8242f8.tar.bz2 |
Adding outbound header filtering to automation HTTP requests.
Review URL: http://codereview.chromium.org/159649
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/url_request_automation_job.cc | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index 3bec65ae..cc4e2df2 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -11,10 +11,32 @@ #include "chrome/test/automation/automation_messages.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" +#include "net/http/http_util.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" +// The list of filtered headers that are removed from requests sent via +// StartAsync(). These must be lower case. +static const char* kFilteredHeaderStrings[] = { + "accept", + "authorization", + "cache-control", + "connection", + "cookie", + "expect", + "if-match", + "if-modified-since", + "if-none-match", + "if-range", + "if-unmodified-since", + "max-forwards", + "proxy-authorization", + "te", + "upgrade", + "via" +}; + // This class manages the interception of network requests for automation. // It looks at the request, and creates an intercept job if it indicates // that it should use automation channel. @@ -279,7 +301,7 @@ void URLRequestAutomationJob::Cleanup() { void URLRequestAutomationJob::StartAsync() { DLOG(INFO) << "URLRequestAutomationJob: start request: " << - request_->url().spec(); + (request_ ? request_->url().spec() : "NULL request"); // If the job is cancelled before we got a chance to start it // we have nothing much to do here. @@ -295,12 +317,18 @@ void URLRequestAutomationJob::StartAsync() { // Register this request with automation message filter. message_filter_->RegisterRequest(this); + // Strip unwanted headers. + std::string new_request_headers( + net::HttpUtil::StripHeaders(request_->extra_request_headers(), + kFilteredHeaderStrings, + arraysize(kFilteredHeaderStrings))); + // Ask automation to start this request. IPC::AutomationURLRequest automation_request = { request_->url().spec(), request_->method(), request_->referrer(), - request_->extra_request_headers(), + new_request_headers, request_->get_upload() }; |