]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: don't set backend's nor response analysers on SF_TUNNEL
authorWilly Tarreau <w@1wt.eu>
Tue, 13 Dec 2016 14:26:56 +0000 (15:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Jun 2017 12:38:02 +0000 (14:38 +0200)
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

index 8e7ac60880ddbc06be281543ea0984bcf7db9311..3781ac75fc054017b7f702ae56cd92f9c4cf325e 100644 (file)
@@ -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) {