apache / apache/trafficserver

Inefficiency in SNI policy parsing

Open
#7,607 5 comments 0 reactions 0 assignees View on GitHub
Performance Stale
Dominant language
C++
Stars
2k
Forks
874
Avg merge
6d 15h
Merged PRs (30d)
46

Description

It seems that rather than parsing these types of "text" configs once, we parse it over and over again (strcmp()) on each transaction hitting this code:

```
std::string_view
HttpSM::get_outbound_sni() const
{
using namespace ts::literals;
ts::TextView zret;
ts::TextView policy{t_state.txn_conf->ssl_client_sni_policy, ts::TextView::npos};

if (policy.empty() || !strcmp(policy, "host"_tv)) {
// By default the host header field value is used for the SNI.
int len;
char const *ptr = t_state.hdr_info.server_request.host_get(&len);
zret.assign(ptr, len);
} else if (ua_txn && !strcmp(policy, "server_name"_tv)) {
zret.assign(ua_txn->get_netvc()->get_server_name(), ts::TextView::npos);
} else if (policy.front() == '@') { // guaranteed non-empty from previous clause
zret = policy.remove_prefix(1);
} else {
// If other is specified, like "remap" and "verify_with_name_source", the remapped origin name is used for the SNI value
zret.assign(t_state.server_info.name, ts::TextView::npos);
}
return zret;
}
````

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.