From 007823b16ebf550f777239919a3ad9af47b597f4 Mon Sep 17 00:00:00 2001 From: Daniel Roethlisberger Date: Wed, 19 Nov 2014 22:39:51 +0100 Subject: [PATCH] Fix connect logging for corner cases --- pxyconn.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pxyconn.c b/pxyconn.c index a55bf45..10dda12 100644 --- a/pxyconn.c +++ b/pxyconn.c @@ -350,6 +350,8 @@ pxy_log_connect_nonhttp(pxy_conn_ctx_t *ctx) ctx->enomem = 1; goto out; } + } else { + lpi = ""; } #endif /* HAVE_LOCAL_PROCINFO */ @@ -401,7 +403,7 @@ pxy_log_connect_nonhttp(pxy_conn_ctx_t *ctx) } out: #ifdef HAVE_LOCAL_PROCINFO - if (lpi) { + if (lpi && ctx->opts->lprocinfo) { free(lpi); } #endif /* HAVE_LOCAL_PROCINFO */ @@ -1717,14 +1719,14 @@ pxy_bev_eventcb(struct bufferevent *bev, short events, void *arg) } } +connected: /* log connection if we don't analyze any headers */ - if (!ctx->spec->http || ctx->passthrough) { - if (WANT_CONNECT_LOG(ctx)) { - pxy_log_connect_nonhttp(ctx); - } + if ((!this->ssl || (bev == ctx->src.bev)) && + (!ctx->spec->http || ctx->passthrough) && + WANT_CONNECT_LOG(ctx)) { + pxy_log_connect_nonhttp(ctx); } -connected: if (OPTS_DEBUG(ctx->opts)) { if (this->ssl) { /* for SSL, we get two connect events */