Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: net/url_request/url_request_http_job.cc

Issue 213010: Don't add default Accept-Language and Accept-Charset headers if specific ones were set in URLRequest (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
===================================================================
--- net/url_request/url_request_http_job.cc (revision 26480)
+++ net/url_request/url_request_http_job.cc (working copy)
@@ -643,11 +643,19 @@
if (context) {
if (context->AllowSendingCookies(request_))
request_info_.extra_headers += AssembleRequestCookies();
- if (!context->accept_language().empty())
- request_info_.extra_headers += "Accept-Language: " +
+
+ // Only add default Accept-Language and Accept-Charset if the request
+ // didn't have them specifically specified.
+ static const std::string kAcceptLanguage = "Accept-Language";
eroman 2009/09/22 01:02:45 Can you make this a const char* instead?
+ if (!context->accept_language().empty() &&
+ !net::HttpUtil::HasHeader(request_info_.extra_headers, kAcceptLanguage.c_str()))
eroman 2009/09/22 01:02:45 break lines at 80 characters.
+ request_info_.extra_headers += kAcceptLanguage + ": " +
context->accept_language() + "\r\n";
- if (!context->accept_charset().empty())
- request_info_.extra_headers += "Accept-Charset: " +
+
+ static const std::string kAcceptCharset = "Accept-Charset";
eroman 2009/09/22 01:02:45 Please only use static const char*.
+ if (!context->accept_charset().empty() &&
+ !net::HttpUtil::HasHeader(request_info_.extra_headers, kAcceptCharset.c_str()))
eroman 2009/09/22 01:02:45 break lines at 80 characters.
+ request_info_.extra_headers += kAcceptCharset + ": " +
eroman 2009/09/22 01:02:45 Since this is the same as for accept-language, can
context->accept_charset() + "\r\n";
}
}
« no previous file with comments | « no previous file | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698