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 2020/06/16 21:38:42 UTC

[trafficserver] branch 9.0.x updated: set sni_name with remapped origin name if sni_policy is not the default value (#6898)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new a787a22  set sni_name with remapped origin name if sni_policy is not the default value (#6898)
a787a22 is described below

commit a787a223359bede7bf63e1ab287d7fc20317fdfd
Author: Xin Li <33...@users.noreply.github.com>
AuthorDate: Mon Jun 15 18:59:49 2020 -0700

    set sni_name with remapped origin name if sni_policy is not the default value (#6898)
    
    Co-authored-by: xinli1 <xi...@linkedin.com>
    (cherry picked from commit 6f564de71cda287b5b79b89d1c8c327a24ba5472)
---
 proxy/http/HttpSM.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 0065775..127c06e 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4749,11 +4749,13 @@ HttpSM::get_outbound_sni() const
 {
   const char *sni_name = nullptr;
   size_t len           = 0;
-  if (t_state.txn_conf->ssl_client_sni_policy != nullptr && !strcmp(t_state.txn_conf->ssl_client_sni_policy, "remap")) {
+  if (t_state.txn_conf->ssl_client_sni_policy == nullptr || !strcmp(t_state.txn_conf->ssl_client_sni_policy, "host")) {
+    // By default the host header field value is used for the SNI.
+    sni_name = t_state.hdr_info.server_request.host_get(reinterpret_cast<int *>(&len));
+  } else {
+    // If other is specified, like "remap" and "verify_with_name_source", the remapped origin name is used for the SNI value
     len      = strlen(t_state.server_info.name);
     sni_name = t_state.server_info.name;
-  } else { // Do the default of host header for SNI
-    sni_name = t_state.hdr_info.server_request.host_get(reinterpret_cast<int *>(&len));
   }
   return std::string_view(sni_name, len);
 }