OLD | NEW |
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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_tokenizer.h" | 8 #include "base/strings/string_tokenizer.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "net/http/http_security_headers.h" | 10 #include "net/http/http_security_headers.h" |
11 #include "net/http/http_util.h" | 11 #include "net/http/http_util.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 COMPILE_ASSERT(kMaxHSTSAgeSecs <= kuint32max, kMaxHSTSAgeSecsTooLarge); | 17 static_assert(kMaxHSTSAgeSecs <= kuint32max, "kMaxHSTSAgeSecs too large"); |
18 | 18 |
19 // MaxAgeToInt converts a string representation of a "whole number" of | 19 // MaxAgeToInt converts a string representation of a "whole number" of |
20 // seconds into a uint32. The string may contain an arbitrarily large number, | 20 // seconds into a uint32. The string may contain an arbitrarily large number, |
21 // which will be clipped to kMaxHSTSAgeSecs and which is guaranteed to fit | 21 // which will be clipped to kMaxHSTSAgeSecs and which is guaranteed to fit |
22 // within a 32-bit unsigned integer. False is returned on any parse error. | 22 // within a 32-bit unsigned integer. False is returned on any parse error. |
23 bool MaxAgeToInt(std::string::const_iterator begin, | 23 bool MaxAgeToInt(std::string::const_iterator begin, |
24 std::string::const_iterator end, | 24 std::string::const_iterator end, |
25 uint32* result) { | 25 uint32* result) { |
26 const std::string s(begin, end); | 26 const std::string s(begin, end); |
27 int64 i = 0; | 27 int64 i = 0; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 336 } |
337 | 337 |
338 if (!found) | 338 if (!found) |
339 hashes->push_back(*i); | 339 hashes->push_back(*i); |
340 } | 340 } |
341 | 341 |
342 return true; | 342 return true; |
343 } | 343 } |
344 | 344 |
345 } // namespace net | 345 } // namespace net |
OLD | NEW |