File: spdy_session_key.cc

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (82 lines) | stat: -rw-r--r-- 3,228 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/spdy/spdy_session_key.h"

#include <optional>
#include <tuple>

#include "base/feature_list.h"
#include "base/logging.h"
#include "base/trace_event/memory_usage_estimator.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_string_util.h"
#include "net/base/session_usage.h"
#include "net/dns/public/secure_dns_policy.h"

namespace net {

SpdySessionKey::SpdySessionKey() = default;

SpdySessionKey::SpdySessionKey(
    const HostPortPair& host_port_pair,
    PrivacyMode privacy_mode,
    const ProxyChain& proxy_chain,
    SessionUsage session_usage,
    const SocketTag& socket_tag,
    const NetworkAnonymizationKey& network_anonymization_key,
    SecureDnsPolicy secure_dns_policy,
    bool disable_cert_verification_network_fetches)
    : host_port_proxy_pair_(host_port_pair, proxy_chain),
      privacy_mode_(privacy_mode),
      session_usage_(session_usage),
      socket_tag_(socket_tag),
      network_anonymization_key_(
          NetworkAnonymizationKey::IsPartitioningEnabled()
              ? network_anonymization_key
              : NetworkAnonymizationKey()),
      secure_dns_policy_(secure_dns_policy),
      disable_cert_verification_network_fetches_(
          disable_cert_verification_network_fetches) {
  DVLOG(1) << "SpdySessionKey(host=" << host_port_pair.ToString()
           << ", proxy_chain=" << proxy_chain << ", privacy=" << privacy_mode;
  DCHECK(disable_cert_verification_network_fetches_ ||
         session_usage_ != SessionUsage::kProxy);
  DCHECK(privacy_mode_ == PRIVACY_MODE_DISABLED ||
         session_usage_ != SessionUsage::kProxy);
}

SpdySessionKey::SpdySessionKey(const SpdySessionKey& other) = default;

SpdySessionKey::~SpdySessionKey() = default;

bool SpdySessionKey::operator<(const SpdySessionKey& other) const {
  return std::tie(privacy_mode_, host_port_proxy_pair_, session_usage_,
                  network_anonymization_key_, secure_dns_policy_,
                  disable_cert_verification_network_fetches_, socket_tag_) <
         std::tie(other.privacy_mode_, other.host_port_proxy_pair_,
                  other.session_usage_, other.network_anonymization_key_,
                  other.secure_dns_policy_,
                  other.disable_cert_verification_network_fetches_,
                  other.socket_tag_);
}

SpdySessionKey::CompareForAliasingResult SpdySessionKey::CompareForAliasing(
    const SpdySessionKey& other) const {
  CompareForAliasingResult result;
  result.is_potentially_aliasable =
      (privacy_mode_ == other.privacy_mode_ &&
       host_port_proxy_pair_.second == other.host_port_proxy_pair_.second &&
       session_usage_ == other.session_usage_ &&
       network_anonymization_key_ == other.network_anonymization_key_ &&
       secure_dns_policy_ == other.secure_dns_policy_ &&
       disable_cert_verification_network_fetches_ ==
           other.disable_cert_verification_network_fetches_);
  result.is_socket_tag_match = (socket_tag_ == other.socket_tag_);
  return result;
}

}  // namespace net