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

Side by Side Diff: net/base/sdch_manager.cc

Issue 1098983003: Switch SchemeIsSecure to SchemeIsCryptographic for referrer-related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « ios/web/public/referrer_util.cc ('k') | net/url_request/url_request_job.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/base/sdch_manager.h" 5 #include "net/base/sdch_manager.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 referrer URL host name 242 referrer URL host name
243 3 The parent domain of the referrer URL host name is not a top level 243 3 The parent domain of the referrer URL host name is not a top level
244 domain 244 domain
245 */ 245 */
246 // Item (1) above implies item (2). Spec should be updated. 246 // Item (1) above implies item (2). Spec should be updated.
247 // I take "host name match" to be "is identical to" 247 // I take "host name match" to be "is identical to"
248 if (referring_url.host() != dictionary_url.host() || 248 if (referring_url.host() != dictionary_url.host() ||
249 referring_url.scheme() != dictionary_url.scheme()) 249 referring_url.scheme() != dictionary_url.scheme())
250 return SDCH_DICTIONARY_LOAD_ATTEMPT_FROM_DIFFERENT_HOST; 250 return SDCH_DICTIONARY_LOAD_ATTEMPT_FROM_DIFFERENT_HOST;
251 251
252 if (!secure_scheme_supported() && referring_url.SchemeIsSecure()) 252 if (!secure_scheme_supported() && referring_url.SchemeIsCryptographic())
253 return SDCH_DICTIONARY_SELECTED_FOR_SSL; 253 return SDCH_DICTIONARY_SELECTED_FOR_SSL;
254 254
255 // TODO(jar): Remove this failsafe conservative hack which is more restrictive 255 // TODO(jar): Remove this failsafe conservative hack which is more restrictive
256 // than current SDCH spec when needed, and justified by security audit. 256 // than current SDCH spec when needed, and justified by security audit.
257 if (!referring_url.SchemeIsHTTPOrHTTPS()) 257 if (!referring_url.SchemeIsHTTPOrHTTPS())
258 return SDCH_DICTIONARY_SELECTED_FROM_NON_HTTP; 258 return SDCH_DICTIONARY_SELECTED_FROM_NON_HTTP;
259 259
260 return SDCH_OK; 260 return SDCH_OK;
261 } 261 }
262 262
(...skipping 28 matching lines...) Expand all
291 const GURL& target_url, 291 const GURL& target_url,
292 const std::string& server_hash, 292 const std::string& server_hash,
293 SdchProblemCode* problem_code) { 293 SdchProblemCode* problem_code) {
294 scoped_ptr<SdchManager::DictionarySet> result; 294 scoped_ptr<SdchManager::DictionarySet> result;
295 295
296 *problem_code = SDCH_DICTIONARY_HASH_NOT_FOUND; 296 *problem_code = SDCH_DICTIONARY_HASH_NOT_FOUND;
297 const auto& it = dictionaries_.find(server_hash); 297 const auto& it = dictionaries_.find(server_hash);
298 if (it == dictionaries_.end()) 298 if (it == dictionaries_.end())
299 return result.Pass(); 299 return result.Pass();
300 300
301 if (!SdchManager::secure_scheme_supported() && target_url.SchemeIsSecure()) { 301 if (!SdchManager::secure_scheme_supported() &&
302 target_url.SchemeIsSecure()) {
302 *problem_code = SDCH_DICTIONARY_FOUND_HAS_WRONG_SCHEME; 303 *problem_code = SDCH_DICTIONARY_FOUND_HAS_WRONG_SCHEME;
303 return result.Pass(); 304 return result.Pass();
304 } 305 }
305 306
306 *problem_code = it->second->data.CanUse(target_url); 307 *problem_code = it->second->data.CanUse(target_url);
307 if (*problem_code != SDCH_OK) 308 if (*problem_code != SDCH_OK)
308 return result.Pass(); 309 return result.Pass();
309 310
310 result.reset(new DictionarySet); 311 result.reset(new DictionarySet);
311 result->AddDictionary(it->first, it->second); 312 result->AddDictionary(it->first, it->second);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 entry_dict->SetInteger("tries", it->second.count); 517 entry_dict->SetInteger("tries", it->second.count);
517 entry_dict->SetInteger("reason", it->second.reason); 518 entry_dict->SetInteger("reason", it->second.reason);
518 entry_list->Append(entry_dict); 519 entry_list->Append(entry_dict);
519 } 520 }
520 value->Set("blacklisted", entry_list); 521 value->Set("blacklisted", entry_list);
521 522
522 return value; 523 return value;
523 } 524 }
524 525
525 } // namespace net 526 } // namespace net
OLDNEW
« no previous file with comments | « ios/web/public/referrer_util.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698