You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.8 KiB

commit 72c692701ab4197f1f8ec7594b7e8ef5082b9d9e
Author: Christopher Faulet <cfaulet@haproxy.com>
Date: Fri Jul 26 16:40:24 2019 +0200
BUG/MINOR: hlua/htx: Reset channels analyzers when txn:done() is called
For HTX streams, when txn:done() is called, the work is delegated to the
function http_reply_and_close(). But it is not enough. The channel's analyzers
must also be reset. Otherwise, some analyzers may still be called while
processing should be aborted.
For instance, if the function is called from an http-request rules on the
frontend, request analyzers on the backend side are still called. So we may try
to add an header to the request, while this one was already reset.
This patch must be backported to 2.0 and 1.9.
(cherry picked from commit fe6a71b8e08234dbe03fbd2fa3017590681479df)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/hlua.c b/src/hlua.c
index 23d2aa04..f9d1d699 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -5996,8 +5996,12 @@ __LJMP static int hlua_txn_done(lua_State *L)
ic = &htxn->s->req;
oc = &htxn->s->res;
- if (IS_HTX_STRM(htxn->s))
- htx_reply_and_close(htxn->s, 0, NULL);
+ if (IS_HTX_STRM(htxn->s)) {
+ htxn->s->txn->status = 0;
+ http_reply_and_close(htxn->s, 0, NULL);
+ ic->analysers &= AN_REQ_FLT_END;
+ oc->analysers &= AN_RES_FLT_END;
+ }
else {
if (htxn->s->txn) {
/* HTTP mode, let's stay in sync with the stream */
@@ -6031,6 +6035,9 @@ __LJMP static int hlua_txn_done(lua_State *L)
ic->analysers = 0;
}
+ if (!(htxn->s->flags & SF_ERR_MASK)) // this is not really an error but it is
+ htxn->s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
+
hlua->flags |= HLUA_STOP;
WILL_LJMP(hlua_done(L));
return 0;