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

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


The following commit(s) were added to refs/heads/9.1.x by this push:
     new 15e2fd4f6 Fix error connection logging crash (#8191)
15e2fd4f6 is described below

commit 15e2fd4f62cc33e0fee466f2df12725475061455
Author: Susan Hinrichs <shinr...@verizonmedia.com>
AuthorDate: Mon Aug 2 19:24:44 2021 -0500

    Fix error connection logging crash (#8191)
    
    (cherry picked from commit 532e30ca1c8c6297f2672f59dab02bd9ef7e7444)
---
 proxy/http/HttpTransact.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 36c53b18c..859ac0045 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3852,9 +3852,12 @@ HttpTransact::error_log_connection_failure(State *s, 
ServerState_t conn_state)
            ats_ip_ntop(&s->current.server->dst_addr.sa, addrbuf, 
sizeof(addrbuf)));
 
   if (s->current.server->had_connect_fail()) {
-    char *url_str = s->hdr_info.client_request.url_string_get(&s->arena);
-    int host_len;
-    const char *host_name_ptr = s->unmapped_url.host_get(&host_len);
+    char *url_str             = 
s->hdr_info.client_request.url_string_get(&s->arena);
+    int host_len              = 0;
+    const char *host_name_ptr = "";
+    if (s->unmapped_url.valid()) {
+      host_name_ptr = s->unmapped_url.host_get(&host_len);
+    }
     std::string_view host_name{host_name_ptr, size_t(host_len)};
     TxnDebug("dead_server", "%s",
              lbw()

Reply via email to