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.
This commit is contained in:
Willy Tarreau 2016-12-13 15:26:56 +01:00
parent 9c26680eb9
commit d62b98c6e8
1 changed files with 7 additions and 5 deletions

View 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->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 /* Be sure to filter response headers if the backend is an HTTP proxy
* and if there are filters attached to the stream. */ * and if there are filters attached to the stream. */
if (s->be->mode == PR_MODE_HTTP && HAS_FILTERS(s)) if (s->be->mode == PR_MODE_HTTP && HAS_FILTERS(s))
rep->analysers |= AN_RES_FLT_HTTP_HDRS; rep->analysers |= AN_RES_FLT_HTTP_HDRS;
}
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */ rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
if (req->flags & CF_WAKE_CONNECT) { if (req->flags & CF_WAKE_CONNECT) {