From d62b98c6e80bd69ff80d80e90e62ab51531bc250 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 13 Dec 2016 15:26:56 +0100 Subject: [PATCH] MINOR: stream: don't set backend's nor response analysers on SF_TUNNEL In order to implement hot-pluggable applets like we'll need for HTTP/2 which will speak a different protocol than the expected one, it will be mandatory to be able to clear all analysers from the request and response channel and/or to keep only the ones the applet initializer installed. Unfortunately for now in sess_establish() we systematically place a number of analysers inherited from the frontend, backend and some hard-coded ones. This patch reuses the now unused SF_TUNNEL flag on the stream to indicate we're dealing with a tunnel and don't want to add more analysers anymore. It will be usable to install such a specific applet. Ideally over the long term it might be nice to be able to set the mode on the stream instead of the proxy so that we can decide to change a stream's mode (eg: TCP, HTTP, HTTP/2) at run time. But it would require many more changes for a gain which is not yet obvious. --- src/stream.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/stream.c b/src/stream.c index 8e7ac60880..3781ac75fc 100644 --- a/src/stream.c +++ b/src/stream.c @@ -724,12 +724,14 @@ static void sess_establish(struct stream *s) rep->flags |= CF_READ_DONTWAIT; /* a single read is enough to get response headers */ } - rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana; + if (!(s->flags & SF_TUNNEL)) { + rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana; - /* Be sure to filter response headers if the backend is an HTTP proxy - * and if there are filters attached to the stream. */ - if (s->be->mode == PR_MODE_HTTP && HAS_FILTERS(s)) - rep->analysers |= AN_RES_FLT_HTTP_HDRS; + /* Be sure to filter response headers if the backend is an HTTP proxy + * and if there are filters attached to the stream. */ + if (s->be->mode == PR_MODE_HTTP && HAS_FILTERS(s)) + rep->analysers |= AN_RES_FLT_HTTP_HDRS; + } rep->flags |= CF_READ_ATTACHED; /* producer is now attached */ if (req->flags & CF_WAKE_CONNECT) { -- 2.39.5