You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/06/29 19:57:03 UTC
[trafficserver] branch master updated: Fix protocol stack to return
unknown TLS string instead of elliding it in case of error.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 1665802 Fix protocol stack to return unknown TLS string instead of elliding it in case of error.
1665802 is described below
commit 166580263ea4e2b67c9ab1e1c74b2ee1786e9080
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Wed Jun 28 20:45:04 2017 -0500
Fix protocol stack to return unknown TLS string instead of elliding it in case of error.
---
iocore/net/SSLNetVConnection.cc | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index fe7970a..24fc8a9 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -1551,25 +1551,30 @@ SSLNetVConnection::populate(Connection &con, Continuation *c, void *arg)
ts::StringView
SSLNetVConnection::map_tls_protocol_to_tag(const char *proto_string) const
{
- // Prefix for the string the SSL library hands back.
- static const ts::StringView PREFIX("TLSv1", ts::StringView::literal);
-
- ts::StringView retval;
- ts::StringView proto(proto_string);
-
- if (PREFIX.isNoCasePrefixOf(proto)) {
- proto += PREFIX.size(); // skip the prefix part.
- if (proto.size() <= 0) {
- retval = IP_PROTO_TAG_TLS_1_0;
- } else if (*proto == '.') {
- ++proto; // skip .
- if (proto.size() == 1) {
- if (*proto == '1') {
+ // tag to use if something goes wrong with fetching the TLS protocol string.
+ static constexpr ts::StringView UNKNOWN("tls/?.?", ts::StringView::literal);
+
+ ts::StringView retval{UNKNOWN}; // return this if the protocol lookup doesn't work.
+
+ if (proto_string) {
+ // openSSL guarantees the case of the protocol string.
+ if (proto_string[0] == 'T' && proto_string[1] == 'L' && proto_string[2] == 'S' && proto_string[3] == 'v' &&
+ proto_string[4] == '1') {
+ if (proto_string[5] == 0) {
+ retval = IP_PROTO_TAG_TLS_1_0;
+ } else if (proto_string[5] == '.' && proto_string[7] == 0) {
+ switch (proto_string[6]) {
+ case '1':
retval = IP_PROTO_TAG_TLS_1_1;
- } else if (*proto == '2') {
+ break;
+ case '2':
retval = IP_PROTO_TAG_TLS_1_2;
- } else if (*proto == '3') {
+ break;
+ case '3':
retval = IP_PROTO_TAG_TLS_1_3;
+ break;
+ default:
+ break;
}
}
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].