From 1295016873ac4b0a2913549a2737cc95a7df2398 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Fri, 23 Nov 2018 14:32:08 +0100 Subject: [PATCH] BUG/MEDIUM: servers: Don't check if we have a conn_stream too soon. The creation of the conn_stream for an outgoing connection has been delayed a bit, and when using dispatch, a check was made to see if a conn_stream was attached before the conn_stream was created, so remove the test, as it's done later anyway, and create and install the conn_stream right away when we don't have a server, as is done when we don't have an alpn/npn defined. --- src/backend.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend.c b/src/backend.c index 862fe3d8d..3ab450bcb 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1253,15 +1253,16 @@ int connect_server(struct stream *s) else if (obj_type(s->target) == OBJ_TYPE_PROXY) { /* proxies exclusively run on raw_sock right now */ conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), xprt_get(XPRT_RAW)); - if (!objt_cs(s->si[1].end) || !objt_cs(s->si[1].end)->conn->ctrl) + if (!(srv_conn->ctrl)) return SF_ERR_INTERNAL; } else return SF_ERR_INTERNAL; /* how did we get there ? */ #ifdef USE_OPENSSL - if ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || - srv->mux_proto) + if (!srv || + ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || + srv->mux_proto)) #endif { srv_cs = si_alloc_cs(&s->si[1], srv_conn);