MINOR: lua: Stop using the lua txn in hlua_http_rep_hdr()
In this function, the lua txn was only used to retrieve the stream. But it can
be retieve from the HTTP message, using its channel pointer. So, the lua txn can
be removed from the function argument list.
This patch is mandatory to allow the support of the filters written in lua.
diff --git a/src/hlua.c b/src/hlua.c
index 7b35a65..c41f04a 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4749,8 +4749,7 @@
* the request or in the response. It is a wrapper fir the
* 4 following functions.
*/
-__LJMP static inline int hlua_http_rep_hdr(lua_State *L, struct hlua_txn *htxn,
- struct http_msg *msg, int full)
+__LJMP static inline int hlua_http_rep_hdr(lua_State *L, struct http_msg *msg, int full)
{
size_t name_len;
const char *name = MAY_LJMP(luaL_checklstring(L, 2, &name_len));
@@ -4763,7 +4762,7 @@
WILL_LJMP(luaL_argerror(L, 3, "invalid regex"));
htx = htxbuf(&msg->chn->buf);
- http_replace_hdrs(htxn->s, htx, ist2(name, name_len), value, re, full);
+ http_replace_hdrs(chn_strm(msg->chn), htx, ist2(name, name_len), value, re, full);
regex_free(re);
return 0;
}
@@ -4778,7 +4777,7 @@
if (htxn->dir != SMP_OPT_DIR_REQ || !(htxn->flags & HLUA_TXN_HTTP_RDY))
WILL_LJMP(lua_error(L));
- return MAY_LJMP(hlua_http_rep_hdr(L, htxn, &htxn->s->txn->req, 1));
+ return MAY_LJMP(hlua_http_rep_hdr(L, &htxn->s->txn->req, 1));
}
__LJMP static int hlua_http_res_rep_hdr(lua_State *L)
@@ -4791,7 +4790,7 @@
if (htxn->dir != SMP_OPT_DIR_RES || !(htxn->flags & HLUA_TXN_HTTP_RDY))
WILL_LJMP(lua_error(L));
- return MAY_LJMP(hlua_http_rep_hdr(L, htxn, &htxn->s->txn->rsp, 1));
+ return MAY_LJMP(hlua_http_rep_hdr(L, &htxn->s->txn->rsp, 1));
}
__LJMP static int hlua_http_req_rep_val(lua_State *L)
@@ -4804,7 +4803,7 @@
if (htxn->dir != SMP_OPT_DIR_REQ || !(htxn->flags & HLUA_TXN_HTTP_RDY))
WILL_LJMP(lua_error(L));
- return MAY_LJMP(hlua_http_rep_hdr(L, htxn, &htxn->s->txn->req, 0));
+ return MAY_LJMP(hlua_http_rep_hdr(L, &htxn->s->txn->req, 0));
}
__LJMP static int hlua_http_res_rep_val(lua_State *L)
@@ -4817,7 +4816,7 @@
if (htxn->dir != SMP_OPT_DIR_RES || !(htxn->flags & HLUA_TXN_HTTP_RDY))
WILL_LJMP(lua_error(L));
- return MAY_LJMP(hlua_http_rep_hdr(L, htxn, &htxn->s->txn->rsp, 0));
+ return MAY_LJMP(hlua_http_rep_hdr(L, &htxn->s->txn->rsp, 0));
}
/* This function deletes all the occurrences of an header.