From fac4bd1492b37640ed5e54c14bdd996ffc3648eb Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 30 Nov 2013 09:21:49 +0100 Subject: [PATCH] MAJOR: session: pass applet return traffic through the response analysers Now that applets work like real connections, there is no reason for them to evade the response analysers. The stats applet emits valid HTTP responses, it can flow through the HTTP response analyser just fine. This now allows http-response/rsprep/rspadd rules to be applied on top of stats. Cookie insertion does nothing since applets are not servers and thus do not have a cookie. We can imagine compression to be applied later if the stats output is emitted in chunks and in HTTP/1.1. A minor visible effect of this change is that there is no more "-1" in the timers presented in the logs when viewing the stats, all timers are real. --- src/session.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/session.c b/src/session.c index 5274971f1e..b7f68bc5f3 100644 --- a/src/session.c +++ b/src/session.c @@ -1176,8 +1176,7 @@ static void sess_prepare_conn_req(struct session *s, struct stream_interface *si si->state = SI_ST_EST; si->err_type = SI_ET_NONE; si->exp = TICK_ETERNITY; - s->req->wex = TICK_ETERNITY; - s->rep->flags |= CF_READ_ATTACHED; /* producer is now attached */ + /* let sess_establish() finish the job */ return; } @@ -2211,6 +2210,10 @@ struct task *process_session(struct task *t) if (s->si[1].state == SI_ST_REQ) { sess_prepare_conn_req(s, &s->si[1]); + /* applets directly go to the ESTABLISHED state */ + if (unlikely(s->si[1].state == SI_ST_EST)) + sess_establish(s, &s->si[1]); + /* Now we can add the server name to a header (if requested) */ /* check for HTTP mode and proxy server_name_hdr_name != NULL */ if ((s->flags & SN_BE_ASSIGNED) && -- 2.47.3