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

Side by Side Diff: net/quic/quic_server_id.cc

Issue 1397983007: relnote: remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rch_insecure_quic
Patch Set: Compile fix Created 5 years, 2 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 | « net/quic/quic_server_id.h ('k') | net/quic/quic_server_id_test.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 "net/quic/quic_server_id.h" 5 #include "net/quic/quic_server_id.h"
6 #include "base/logging.h"
6 7
7 #include "net/base/host_port_pair.h" 8 #include "net/base/host_port_pair.h"
8 #include "net/base/port_util.h" 9 #include "net/base/port_util.h"
9 #include "url/gurl.h" 10 #include "url/gurl.h"
10 11
11 using std::string; 12 using std::string;
12 13
13 namespace net { 14 namespace net {
14 15
15 QuicServerId::QuicServerId() 16 QuicServerId::QuicServerId() : privacy_mode_(PRIVACY_MODE_DISABLED) {}
16 : is_https_(false), privacy_mode_(PRIVACY_MODE_DISABLED) {
17 }
18 17
19 QuicServerId::QuicServerId(const HostPortPair& host_port_pair, 18 QuicServerId::QuicServerId(const HostPortPair& host_port_pair,
20 bool is_https,
21 PrivacyMode privacy_mode) 19 PrivacyMode privacy_mode)
22 : host_port_pair_(host_port_pair), 20 : host_port_pair_(host_port_pair),
23 is_https_(is_https),
24 privacy_mode_(privacy_mode) {} 21 privacy_mode_(privacy_mode) {}
25 22
23 QuicServerId::QuicServerId(const string& host, uint16 port)
24 : host_port_pair_(host, port), privacy_mode_(PRIVACY_MODE_DISABLED) {}
25
26 QuicServerId::QuicServerId(const string& host, 26 QuicServerId::QuicServerId(const string& host,
27 uint16 port, 27 uint16 port,
28 bool is_https)
29 : host_port_pair_(host, port),
30 is_https_(is_https),
31 privacy_mode_(PRIVACY_MODE_DISABLED) {}
32
33 QuicServerId::QuicServerId(const string& host,
34 uint16 port,
35 bool is_https,
36 PrivacyMode privacy_mode) 28 PrivacyMode privacy_mode)
37 : host_port_pair_(host, port), 29 : host_port_pair_(host, port),
38 is_https_(is_https),
39 privacy_mode_(privacy_mode) {} 30 privacy_mode_(privacy_mode) {}
40 31
41 QuicServerId::~QuicServerId() {} 32 QuicServerId::~QuicServerId() {}
42 33
43 bool QuicServerId::operator<(const QuicServerId& other) const { 34 bool QuicServerId::operator<(const QuicServerId& other) const {
44 if (!host_port_pair_.Equals(other.host_port_pair_)) { 35 if (!host_port_pair_.Equals(other.host_port_pair_)) {
45 return host_port_pair_ < other.host_port_pair_; 36 return host_port_pair_ < other.host_port_pair_;
46 } 37 }
47 if (is_https_ != other.is_https_) {
48 return is_https_ < other.is_https_;
49 }
50 return privacy_mode_ < other.privacy_mode_; 38 return privacy_mode_ < other.privacy_mode_;
51 } 39 }
52 40
53 bool QuicServerId::operator==(const QuicServerId& other) const { 41 bool QuicServerId::operator==(const QuicServerId& other) const {
54 return is_https_ == other.is_https_ && 42 return privacy_mode_ == other.privacy_mode_ &&
55 privacy_mode_ == other.privacy_mode_ && 43 host_port_pair_.Equals(other.host_port_pair_);
56 host_port_pair_.Equals(other.host_port_pair_);
57 } 44 }
58 45
59 // static 46 // static
60 QuicServerId QuicServerId::FromString(const std::string& str) { 47 QuicServerId QuicServerId::FromString(const std::string& str) {
61 GURL url(str); 48 GURL url(str);
62 if (!url.is_valid()) 49 if (!url.is_valid())
63 return QuicServerId(); 50 return QuicServerId();
64 return QuicServerId( 51 return QuicServerId(HostPortPair::FromURL(url), url.path() == "/private"
65 HostPortPair::FromURL(url), url.scheme() == "https", 52 ? PRIVACY_MODE_ENABLED
66 url.path() == "/private" ? PRIVACY_MODE_ENABLED : PRIVACY_MODE_DISABLED); 53 : PRIVACY_MODE_DISABLED);
67 } 54 }
68 55
69 string QuicServerId::ToString() const { 56 string QuicServerId::ToString() const {
70 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString() + 57 return "https://" + host_port_pair_.ToString() +
71 (privacy_mode_ == PRIVACY_MODE_ENABLED ? "/private" : ""); 58 (privacy_mode_ == PRIVACY_MODE_ENABLED ? "/private" : "");
72 } 59 }
73 60
74 } // namespace net 61 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_server_id.h ('k') | net/quic/quic_server_id_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698