From e36a49667777e33db1580856b5c9bbd2761e3354 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Fri, 30 Jul 2021 19:09:50 +0000 Subject: [PATCH] Fix error connection logging crash --- 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 ce2d7fae035..f924caa9dc6 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -3906,9 +3906,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)}; Log::error("%s", lbw() .clip(1)