int http_header_match2(const char *hdr, const char *end, const char *name, int len);
int http_remove_header2(struct http_msg *msg, struct hdr_idx *idx, struct hdr_ctx *ctx);
int http_header_add_tail2(struct http_msg *msg, struct hdr_idx *hdr_idx, const char *text, int len);
-int http_replace_req_line(int action, const char *replace, int len,
- struct proxy *px, struct stream *s, struct http_txn *txn);
+int http_replace_req_line(int action, const char *replace, int len, struct proxy *px, struct stream *s);
int http_transform_header_str(struct stream* s, struct http_msg *msg, const char* name,
unsigned int name_len, const char *str, struct my_regex *re,
int action);
struct list list;
struct acl_cond *cond; /* acl condition to meet */
unsigned int action; /* HTTP_REQ_* */
- int (*action_ptr)(struct http_req_rule *rule, struct proxy *px, struct stream *s, struct http_txn *http_txn); /* ptr to custom action */
+ int (*action_ptr)(struct http_req_rule *rule, struct proxy *px, struct stream *s); /* ptr to custom action */
union {
struct {
char *realm;
struct list list;
struct acl_cond *cond; /* acl condition to meet */
unsigned int action; /* HTTP_RES_* */
- int (*action_ptr)(struct http_res_rule *rule, struct proxy *px, struct stream *s, struct http_txn *http_txn); /* ptr to custom action */
+ int (*action_ptr)(struct http_res_rule *rule, struct proxy *px, struct stream *s); /* ptr to custom action */
union {
struct {
char *name; /* header name */
struct hlua_txn *htxn = MAY_LJMP(hlua_checkhttp(L, 1));
size_t name_len;
const char *name = MAY_LJMP(luaL_checklstring(L, 2, &name_len));
- struct http_txn *txn = htxn->s->txn;
- lua_pushboolean(L, http_replace_req_line(0, name, name_len, htxn->p, htxn->s, txn) != -1);
+ lua_pushboolean(L, http_replace_req_line(0, name, name_len, htxn->p, htxn->s) != -1);
return 1;
}
struct hlua_txn *htxn = MAY_LJMP(hlua_checkhttp(L, 1));
size_t name_len;
const char *name = MAY_LJMP(luaL_checklstring(L, 2, &name_len));
- struct http_txn *txn = htxn->s->txn;
-
- lua_pushboolean(L, http_replace_req_line(1, name, name_len, htxn->p, htxn->s, txn) != -1);
+ lua_pushboolean(L, http_replace_req_line(1, name, name_len, htxn->p, htxn->s) != -1);
return 1;
}
struct hlua_txn *htxn = MAY_LJMP(hlua_checkhttp(L, 1));
size_t name_len;
const char *name = MAY_LJMP(luaL_checklstring(L, 2, &name_len));
- struct http_txn *txn = htxn->s->txn;
/* Check length. */
if (name_len > trash.size - 1) {
memcpy(trash.str + trash.len, name, name_len);
trash.len += name_len;
- lua_pushboolean(L, http_replace_req_line(2, trash.str, trash.len, htxn->p, htxn->s, txn) != -1);
+ lua_pushboolean(L, http_replace_req_line(2, trash.str, trash.len, htxn->p, htxn->s) != -1);
return 1;
}
struct hlua_txn *htxn = MAY_LJMP(hlua_checkhttp(L, 1));
size_t name_len;
const char *name = MAY_LJMP(luaL_checklstring(L, 2, &name_len));
- struct http_txn *txn = htxn->s->txn;
- lua_pushboolean(L, http_replace_req_line(3, name, name_len, htxn->p, htxn->s, txn) != -1);
+ lua_pushboolean(L, http_replace_req_line(3, name, name_len, htxn->p, htxn->s) != -1);
return 1;
}
* the LUA code.
*/
int hlua_http_req_act_wrapper(struct http_req_rule *rule, struct proxy *px,
- struct stream *s, struct http_txn *http_txn)
+ struct stream *s)
{
return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px,
- s, http_txn, AN_REQ_HTTP_PROCESS_FE);
+ s, s->txn, AN_REQ_HTTP_PROCESS_FE);
}
/* Lua execution wrapper for http-response.
* the LUA code.
*/
int hlua_http_res_act_wrapper(struct http_res_rule *rule, struct proxy *px,
- struct stream *s, struct http_txn *http_txn)
+ struct stream *s)
{
return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px,
- s, http_txn, AN_RES_HTTP_PROCESS_BE);
+ s, s->txn, AN_RES_HTTP_PROCESS_BE);
}
/* tcp-request <*> configuration wrapper. */
* on txn->flags if it encounters a tarpit rule.
*/
enum rule_result
-http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn)
+http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s)
{
struct session *sess = strm_sess(s);
+ struct http_txn *txn = s->txn;
struct connection *cli_conn;
struct http_req_rule *rule;
struct hdr_ctx ctx;
}
case HTTP_REQ_ACT_CUSTOM_CONT:
- if (!rule->action_ptr(rule, px, s, txn)) {
+ if (!rule->action_ptr(rule, px, s)) {
s->current_rule = &rule->list;
return HTTP_RULE_RES_YIELD;
}
break;
case HTTP_REQ_ACT_CUSTOM_STOP:
- rule->action_ptr(rule, px, s, txn);
+ rule->action_ptr(rule, px, s);
return HTTP_RULE_RES_DONE;
case HTTP_REQ_ACT_TRK_SC0 ... HTTP_REQ_ACT_TRK_SCMAX:
* the same context.
*/
static enum rule_result
-http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn)
+http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s)
{
struct session *sess = strm_sess(s);
+ struct http_txn *txn = s->txn;
struct connection *cli_conn;
struct http_res_rule *rule;
struct hdr_ctx ctx;
}
case HTTP_RES_ACT_CUSTOM_CONT:
- if (!rule->action_ptr(rule, px, s, txn)) {
+ if (!rule->action_ptr(rule, px, s)) {
s->current_rule = &rule->list;
return HTTP_RULE_RES_YIELD;
}
break;
case HTTP_RES_ACT_CUSTOM_STOP:
- rule->action_ptr(rule, px, s, txn);
+ rule->action_ptr(rule, px, s);
return HTTP_RULE_RES_STOP;
}
}
/* evaluate http-request rules */
if (!LIST_ISEMPTY(&px->http_req_rules)) {
- verdict = http_req_get_intercept_rule(px, &px->http_req_rules, s, txn);
+ verdict = http_req_get_intercept_rule(px, &px->http_req_rules, s);
switch (verdict) {
case HTTP_RULE_RES_YIELD: /* some data miss, call the function later. */
/* parse the whole stats request and extract the relevant information */
http_handle_stats(s, req);
- verdict = http_req_get_intercept_rule(px, &px->uri_auth->http_req_rules, s, txn);
+ verdict = http_req_get_intercept_rule(px, &px->uri_auth->http_req_rules, s);
/* not all actions implemented: deny, allow, auth */
if (verdict == HTTP_RULE_RES_DENY) /* stats http-request deny */
/* evaluate http-response rules */
if (ret == HTTP_RULE_RES_CONT)
- ret = http_res_get_intercept_rule(cur_proxy, &cur_proxy->http_res_rules, s, txn);
+ ret = http_res_get_intercept_rule(cur_proxy, &cur_proxy->http_res_rules, s);
/* we need to be called again. */
if (ret == HTTP_RULE_RES_YIELD) {
* string by the caller, event if the replacement query string is empty.
*/
int http_replace_req_line(int action, const char *replace, int len,
- struct proxy *px, struct stream *s, struct http_txn *txn)
+ struct proxy *px, struct stream *s)
{
+ struct http_txn *txn = s->txn;
char *cur_ptr, *cur_end;
int offset = 0;
int delta;
* http_action_set_req_line_exec(). It always returns 1. If an error occurs
* the action is canceled, but the rule processing continue.
*/
-int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct stream *s, struct http_txn *txn)
+int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct stream *s)
{
chunk_reset(&trash);
trash.str[trash.len++] = '?';
trash.len += build_logline(s, trash.str + trash.len, trash.size - trash.len, (struct list *)&rule->arg.act.p[0]);
- http_replace_req_line(*(int *)&rule->arg.act.p[2], trash.str, trash.len, px, s, txn);
+ http_replace_req_line(*(int *)&rule->arg.act.p[2], trash.str, trash.len, px, s);
return 1;
}