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

Side by Side Diff: google_apis/gcm/engine/registration_request.cc

Issue 148153003: Fix double escaping of senderIds in registration request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 | google_apis/gcm/engine/registration_request_unittest.cc » ('j') | 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 "google_apis/gcm/engine/registration_request.h" 5 #include "google_apis/gcm/engine/registration_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 BuildFormEncoding(kDeviceIdKey, android_id, &body); 104 BuildFormEncoding(kDeviceIdKey, android_id, &body);
105 105
106 std::string senders; 106 std::string senders;
107 for (std::vector<std::string>::const_iterator iter = 107 for (std::vector<std::string>::const_iterator iter =
108 request_info_.sender_ids.begin(); 108 request_info_.sender_ids.begin();
109 iter != request_info_.sender_ids.end(); 109 iter != request_info_.sender_ids.end();
110 ++iter) { 110 ++iter) {
111 DCHECK(!iter->empty()); 111 DCHECK(!iter->empty());
112 if (!senders.empty()) 112 if (!senders.empty())
113 senders.append(","); 113 senders.append(",");
114 senders.append(net::EscapeUrlEncodedData(*iter, true)); 114 senders.append(*iter);
115 } 115 }
116 BuildFormEncoding(kSenderKey, senders, &body); 116 BuildFormEncoding(kSenderKey, senders, &body);
117 117
118 if (request_info_.user_serial_number != 0) { 118 if (request_info_.user_serial_number != 0) {
119 DCHECK(request_info_.user_android_id != 0); 119 DCHECK(request_info_.user_android_id != 0);
120 BuildFormEncoding(kUserSerialNumberKey, 120 BuildFormEncoding(kUserSerialNumberKey,
121 base::IntToString(request_info_.user_serial_number), 121 base::IntToString(request_info_.user_serial_number),
122 &body); 122 &body);
123 BuildFormEncoding(kUserAndroidIdKey, 123 BuildFormEncoding(kUserAndroidIdKey,
124 base::Uint64ToString(request_info_.user_android_id), 124 base::Uint64ToString(request_info_.user_android_id),
(...skipping 22 matching lines...) Expand all
147 size_t token_pos = response.find(kTokenPrefix); 147 size_t token_pos = response.find(kTokenPrefix);
148 std::string token; 148 std::string token;
149 if (token_pos != std::string::npos) 149 if (token_pos != std::string::npos)
150 token = response.substr(token_pos + strlen(kTokenPrefix)); 150 token = response.substr(token_pos + strlen(kTokenPrefix));
151 else 151 else
152 LOG(ERROR) << "Failed to extract token."; 152 LOG(ERROR) << "Failed to extract token.";
153 callback_.Run(token); 153 callback_.Run(token);
154 } 154 }
155 155
156 } // namespace gcm 156 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | google_apis/gcm/engine/registration_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698