MCPcopy Create free account
hub / github.com/apache/trafficserver / validate_sni

Method validate_sni

src/proxy/http/HttpSessionManager.cc:113–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113bool
114ServerSessionPool::validate_sni(HttpSM *sm, NetVConnection *netvc)
115{
116 bool retval = true;
117 // Verify that the sni name on this connection would match the sni we would have use to create
118 // a new connection.
119 //
120 if (sm->t_state.scheme == URL_WKSIDX_HTTPS) {
121 if (auto snis = netvc->get_service<TLSSNISupport>(); snis) {
122 const char *session_sni = snis->get_sni_server_name();
123 std::string_view proposed_sni = sm->get_outbound_sni();
124 Dbg(dbg_ctl_http_ss, "validate_sni proposed_sni=%.*s, sni=%s", static_cast<int>(proposed_sni.length()), proposed_sni.data(),
125 session_sni);
126 if (!session_sni || session_sni[0] == '\0' || proposed_sni.length() == 0) {
127 retval = session_sni == nullptr && proposed_sni.length() == 0;
128 } else {
129 retval = proposed_sni.compare(session_sni) == 0;
130 }
131 } else {
132 retval = false;
133 }
134 }
135 return retval;
136}
137
138bool
139ServerSessionPool::validate_cert(HttpSM *sm, NetVConnection *netvc)

Callers

nothing calls this directly

Calls 5

get_sni_server_nameMethod · 0.80
get_outbound_sniMethod · 0.80
lengthMethod · 0.45
dataMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected