serve(): Increase the chances that the host is logged
authorFabian Keil <fk@fabiankeil.de>
Mon, 15 Feb 2021 15:47:03 +0000 (16:47 +0100)
committerFabian Keil <fk@fabiankeil.de>
Sun, 21 Feb 2021 15:09:20 +0000 (16:09 +0100)
... when closing a server socket.

jcc.c

diff --git a/jcc.c b/jcc.c
index c1a3a6e..1e8ad44 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -4811,7 +4811,8 @@ static void serve(struct client_state *csp)
             log_error(LOG_LEVEL_CONNECT,
                "Closing server socket %d connected to %s. "
                "Keep-alive: %u. Tainted: %u. Socket alive: %u. Timeout: %u.",
-               csp->server_connection.sfd, csp->server_connection.host,
+               csp->server_connection.sfd, (csp->server_connection.host != NULL) ?
+               csp->server_connection.host : csp->http->host,
                0 != (csp->flags & CSP_FLAG_SERVER_CONNECTION_KEEP_ALIVE),
                0 != (csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED),
                socket_is_still_alive(csp->server_connection.sfd),