Fix connect logging for corner cases

This commit is contained in:
Daniel Roethlisberger 2014-11-19 22:39:51 +01:00
parent 80af8f7d52
commit 007823b16e

View File

@ -350,6 +350,8 @@ pxy_log_connect_nonhttp(pxy_conn_ctx_t *ctx)
ctx->enomem = 1; ctx->enomem = 1;
goto out; goto out;
} }
} else {
lpi = "";
} }
#endif /* HAVE_LOCAL_PROCINFO */ #endif /* HAVE_LOCAL_PROCINFO */
@ -401,7 +403,7 @@ pxy_log_connect_nonhttp(pxy_conn_ctx_t *ctx)
} }
out: out:
#ifdef HAVE_LOCAL_PROCINFO #ifdef HAVE_LOCAL_PROCINFO
if (lpi) { if (lpi && ctx->opts->lprocinfo) {
free(lpi); free(lpi);
} }
#endif /* HAVE_LOCAL_PROCINFO */ #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 */ /* log connection if we don't analyze any headers */
if (!ctx->spec->http || ctx->passthrough) { if ((!this->ssl || (bev == ctx->src.bev)) &&
if (WANT_CONNECT_LOG(ctx)) { (!ctx->spec->http || ctx->passthrough) &&
pxy_log_connect_nonhttp(ctx); WANT_CONNECT_LOG(ctx)) {
} pxy_log_connect_nonhttp(ctx);
} }
connected:
if (OPTS_DEBUG(ctx->opts)) { if (OPTS_DEBUG(ctx->opts)) {
if (this->ssl) { if (this->ssl) {
/* for SSL, we get two connect events */ /* for SSL, we get two connect events */