| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/transport_security_state.h" | 5 #include "net/base/transport_security_state.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 bool include_subdomains; | 405 bool include_subdomains; |
| 406 char dns_name[30]; | 406 char dns_name[30]; |
| 407 } kPreloadedSTS[] = { | 407 } kPreloadedSTS[] = { |
| 408 {16, false, "\003www\006paypal\003com"}, | 408 {16, false, "\003www\006paypal\003com"}, |
| 409 {16, false, "\003www\006elanex\003biz"}, | 409 {16, false, "\003www\006elanex\003biz"}, |
| 410 {12, true, "\006jottit\003com"}, | 410 {12, true, "\006jottit\003com"}, |
| 411 {19, true, "\015sunshinepress\003org"}, | 411 {19, true, "\015sunshinepress\003org"}, |
| 412 {21, false, "\003www\013noisebridge\003net"}, | 412 {21, false, "\003www\013noisebridge\003net"}, |
| 413 {10, false, "\004neg9\003org"}, | 413 {10, false, "\004neg9\003org"}, |
| 414 {11, false, "\006factor\002cc"}, | 414 {11, false, "\006factor\002cc"}, |
| 415 {19, true, "\015splendidbacon\003com"}, |
| 415 }; | 416 }; |
| 416 static const size_t kNumPreloadedSTS = ARRAYSIZE_UNSAFE(kPreloadedSTS); | 417 static const size_t kNumPreloadedSTS = ARRAYSIZE_UNSAFE(kPreloadedSTS); |
| 417 | 418 |
| 418 for (size_t i = 0; canonicalised_host[i]; i += canonicalised_host[i] + 1) { | 419 for (size_t i = 0; canonicalised_host[i]; i += canonicalised_host[i] + 1) { |
| 419 for (size_t j = 0; j < kNumPreloadedSTS; j++) { | 420 for (size_t j = 0; j < kNumPreloadedSTS; j++) { |
| 420 if (kPreloadedSTS[j].length == canonicalised_host.size() - i && | 421 if (kPreloadedSTS[j].length == canonicalised_host.size() - i && |
| 421 (kPreloadedSTS[j].include_subdomains || i == 0) && | 422 (kPreloadedSTS[j].include_subdomains || i == 0) && |
| 422 memcmp(kPreloadedSTS[j].dns_name, &canonicalised_host[i], | 423 memcmp(kPreloadedSTS[j].dns_name, &canonicalised_host[i], |
| 423 kPreloadedSTS[j].length) == 0) { | 424 kPreloadedSTS[j].length) == 0) { |
| 424 *include_subdomains = kPreloadedSTS[j].include_subdomains; | 425 *include_subdomains = kPreloadedSTS[j].include_subdomains; |
| 425 return true; | 426 return true; |
| 426 } | 427 } |
| 427 } | 428 } |
| 428 } | 429 } |
| 429 | 430 |
| 430 return false; | 431 return false; |
| 431 } | 432 } |
| 432 | 433 |
| 433 } // namespace | 434 } // namespace |
| OLD | NEW |