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

Side by Side Diff: components/metrics/net/net_metrics_log_uploader.cc

Issue 2637843003: Explicitly drop auth data in metrics uploads. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/net/net_metrics_log_uploader.h" 5 #include "components/metrics/net/net_metrics_log_uploader.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "components/data_use_measurement/core/data_use_user_data.h" 8 #include "components/data_use_measurement/core/data_use_user_data.h"
9 #include "net/base/load_flags.h" 9 #include "net/base/load_flags.h"
10 #include "net/url_request/url_fetcher.h" 10 #include "net/url_request/url_fetcher.h"
(...skipping 21 matching lines...) Expand all
32 current_fetch_.get(), data_use_measurement::DataUseUserData::UMA); 32 current_fetch_.get(), data_use_measurement::DataUseUserData::UMA);
33 current_fetch_->SetRequestContext(request_context_getter_); 33 current_fetch_->SetRequestContext(request_context_getter_);
34 current_fetch_->SetUploadData(mime_type_, compressed_log_data); 34 current_fetch_->SetUploadData(mime_type_, compressed_log_data);
35 35
36 // Tell the server that we're uploading gzipped protobufs. 36 // Tell the server that we're uploading gzipped protobufs.
37 current_fetch_->SetExtraRequestHeaders("content-encoding: gzip"); 37 current_fetch_->SetExtraRequestHeaders("content-encoding: gzip");
38 38
39 DCHECK(!log_hash.empty()); 39 DCHECK(!log_hash.empty());
40 current_fetch_->AddExtraRequestHeader("X-Chrome-UMA-Log-SHA1: " + log_hash); 40 current_fetch_->AddExtraRequestHeader("X-Chrome-UMA-Log-SHA1: " + log_hash);
41 41
42 // We already drop cookies server-side, but we might as well strip them out 42 // Drop cookies and auth data.
43 // client-side as well.
44 current_fetch_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 43 current_fetch_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
44 net::LOAD_DO_NOT_SEND_AUTH_DATA |
45 net::LOAD_DO_NOT_SEND_COOKIES); 45 net::LOAD_DO_NOT_SEND_COOKIES);
46 current_fetch_->Start(); 46 current_fetch_->Start();
47 } 47 }
48 48
49 void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) { 49 void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) {
50 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. 50 // We're not allowed to re-use the existing |URLFetcher|s, so free them here.
51 // Note however that |source| is aliased to the fetcher, so we should be 51 // Note however that |source| is aliased to the fetcher, so we should be
52 // careful not to delete it too early. 52 // careful not to delete it too early.
53 DCHECK_EQ(current_fetch_.get(), source); 53 DCHECK_EQ(current_fetch_.get(), source);
54 54
55 int response_code = source->GetResponseCode(); 55 int response_code = source->GetResponseCode();
56 if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID) 56 if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID)
57 response_code = -1; 57 response_code = -1;
58 current_fetch_.reset(); 58 current_fetch_.reset();
59 on_upload_complete_.Run(response_code); 59 on_upload_complete_.Run(response_code);
60 } 60 }
61 61
62 } // namespace metrics 62 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698