Revert 90354 - Revert 90352 - Move Referer header to extra_headers field

Reapply http://codereview.chromium.org/6995064 after fixing the chrome_frame_net_tests.


BUG=no
TEST=no


Review URL: http://codereview.chromium.org/7230009

[email protected]
Review URL: http://codereview.chromium.org/7236031

[email protected]
Review URL: http://codereview.chromium.org/7264017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90548 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 8b06a3b..d7a65e2 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -695,13 +695,6 @@
     request_headers_.SetHeader(HttpRequestHeaders::kConnection, "keep-alive");
   }
 
-  // Our consumer should have made sure that this is a safe referrer.  See for
-  // instance WebCore::FrameLoader::HideReferrer.
-  if (request_->referrer.is_valid()) {
-    request_headers_.SetHeader(HttpRequestHeaders::kReferer,
-                               request_->referrer.spec());
-  }
-
   // Add a content length header?
   if (request_body_.get()) {
     if (request_body_->is_chunked()) {
@@ -736,20 +729,7 @@
     auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader(
         &request_headers_);
 
-  // Headers that will be stripped from request_->extra_headers to prevent,
-  // e.g., plugins from overriding headers that are controlled using other
-  // means. Otherwise a plugin could set a referrer although sending the
-  // referrer is inhibited.
-  // TODO(jochen): check whether also other headers should be stripped.
-  static const char* const kExtraHeadersToBeStripped[] = {
-    "Referer"
-  };
-
-  HttpRequestHeaders stripped_extra_headers;
-  stripped_extra_headers.CopyFrom(request_->extra_headers);
-  for (size_t i = 0; i < arraysize(kExtraHeadersToBeStripped); ++i)
-    stripped_extra_headers.RemoveHeader(kExtraHeadersToBeStripped[i]);
-  request_headers_.MergeFrom(stripped_extra_headers);
+  request_headers_.MergeFrom(request_->extra_headers);
 }
 
 int HttpNetworkTransaction::DoBuildRequest() {