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

Unified Diff: components/cronet/android/url_request_peer.cc

Issue 344793006: Generate Cronet Version.java based on VERSION and LASTCHANGE files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Matt's comments. Created 6 years, 6 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 | « components/cronet/android/url_request_context_peer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/url_request_peer.cc
diff --git a/components/cronet/android/url_request_peer.cc b/components/cronet/android/url_request_peer.cc
index 54094bf6773fc760639c32b003d348ae6d816922..1a163fd6af5791bc82abdf9280ca03967e7a0ab1 100644
--- a/components/cronet/android/url_request_peer.cc
+++ b/components/cronet/android/url_request_peer.cc
@@ -12,10 +12,6 @@ namespace cronet {
static const size_t kBufferSizeIncrement = 8192;
-// Fragment automatically inserted in the User-Agent header to indicate
-// that the request is coming from this network stack.
-static const char kUserAgentFragment[] = "; ChromiumJNI/";
-
URLRequestPeer::URLRequestPeer(URLRequestContextPeer* context,
URLRequestPeerDelegate* delegate,
GURL url,
@@ -110,21 +106,12 @@ void URLRequestPeer::OnInitiateConnection() {
net::LOAD_DO_NOT_SEND_COOKIES);
url_request_->set_method(method_);
url_request_->SetExtraRequestHeaders(headers_);
- std::string user_agent;
- if (headers_.HasHeader(net::HttpRequestHeaders::kUserAgent)) {
- headers_.GetHeader(net::HttpRequestHeaders::kUserAgent, &user_agent);
- } else {
+ if (!headers_.HasHeader(net::HttpRequestHeaders::kUserAgent)) {
+ std::string user_agent;
user_agent = context_->GetUserAgent(url_);
- }
- size_t pos = user_agent.find(')');
- if (pos != std::string::npos) {
- user_agent.insert(pos, context_->version());
- user_agent.insert(pos, kUserAgentFragment);
- }
- url_request_->SetExtraRequestHeaderByName(
+ url_request_->SetExtraRequestHeaderByName(
net::HttpRequestHeaders::kUserAgent, user_agent, true /* override */);
-
- VLOG(context_->logging_level()) << "User agent: " << user_agent;
+ }
if (upload_data_stream_) {
url_request_->set_upload(make_scoped_ptr(upload_data_stream_.release()));
« no previous file with comments | « components/cronet/android/url_request_context_peer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698