case HTTP_RULE_RES_BADREQ: /* failed with a bad request */
goto return_bad_req;
+
+ case HTTP_RULE_RES_ERROR: /* failed with a bad request */
+ goto return_int_err;
}
}
if (verdict == HTTP_RULE_RES_ABRT) /* stats auth / stats http-request auth */
goto return_prx_cond;
+
+ if (verdict == HTTP_RULE_RES_BADREQ) /* failed with a bad request */
+ goto return_bad_req;
+
+ if (verdict == HTTP_RULE_RES_ERROR) /* failed with a bad request */
+ goto return_int_err;
}
/* Proceed with the applets now. */
if (ret == HTTP_RULE_RES_CONT) {
ret = http_res_get_intercept_rule(cur_proxy, &cur_proxy->http_res_rules, s);
- goto return_bad_res;
+ switch (ret) {
+ case HTTP_RULE_RES_YIELD: /* some data miss, call the function later. */
+ goto return_prx_yield;
+
+ case HTTP_RULE_RES_CONT:
+ case HTTP_RULE_RES_STOP: /* nothing to do */
+ break;
+
+ case HTTP_RULE_RES_DENY: /* deny or tarpit */
+ goto deny;
+
+ case HTTP_RULE_RES_ABRT: /* abort request, response already sent */
+ goto return_prx_cond;
- if (ret == HTTP_RULE_RES_DONE)
+ case HTTP_RULE_RES_DONE: /* OK, but terminate request processing (eg: redirect) */
goto done;
- }
- /* we need to be called again. */
- if (ret == HTTP_RULE_RES_YIELD)
- goto return_prx_yield;
+ case HTTP_RULE_RES_BADREQ: /* failed with a bad request */
+ goto return_bad_res;
- /* has the response been denied ? */
- if (txn->flags & TX_SVDENY)
- goto deny;
+ case HTTP_RULE_RES_ERROR: /* failed with a bad request */
+ goto return_int_err;
+ }
+
+ }
/* check whether we're already working on the frontend */
if (cur_proxy == sess->fe)
*/
rule_ret = HTTP_RULE_RES_ABRT;
if (http_reply_40x_unauthorized(s, auth_realm) == -1)
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
stream_inc_http_err_ctr(s);
goto end;
case ACT_HTTP_REDIR:
rule_ret = HTTP_RULE_RES_DONE;
if (!http_apply_redirect_rule(rule->arg.redir, s, txn))
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
case ACT_HTTP_SET_NICE:
ist2(rule->arg.hdr_add.name, rule->arg.hdr_add.name_len),
&rule->arg.hdr_add.fmt,
rule->arg.hdr_add.re, rule->action)) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
break;
replace = alloc_trash_chunk();
if (!replace) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
/* allocate key */
key = alloc_trash_chunk();
if (!key) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
/* allocate key */
key = alloc_trash_chunk();
if (!key) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
/* allocate key */
key = alloc_trash_chunk();
if (!key) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
value = alloc_trash_chunk();
if (!value) {
free_trash_chunk(key);
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
ist2(rule->arg.early_hint.name, rule->arg.early_hint.name_len),
&rule->arg.early_hint.fmt);
if (early_hints == -1) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
break;
switch (rule->action_ptr(rule, px, s->sess, s, act_flags)) {
case ACT_RET_ERR:
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
case ACT_RET_CONT:
break;
end:
if (early_hints) {
if (http_reply_103_early_hints(&s->res) == -1)
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
}
/* we reached the end of the rules, nothing to report */
goto end;
case ACT_ACTION_DENY:
- txn->flags |= TX_SVDENY;
- rule_ret = HTTP_RULE_RES_STOP;
+ rule_ret = HTTP_RULE_RES_DENY;
goto end;
case ACT_HTTP_SET_NICE:
ist2(rule->arg.hdr_add.name, rule->arg.hdr_add.name_len),
&rule->arg.hdr_add.fmt,
rule->arg.hdr_add.re, rule->action)) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
break;
replace = alloc_trash_chunk();
if (!replace) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
/* allocate key */
key = alloc_trash_chunk();
if (!key) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
/* allocate key */
key = alloc_trash_chunk();
if (!key) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
/* allocate key */
key = alloc_trash_chunk();
if (!key) {
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
value = alloc_trash_chunk();
if (!value) {
free_trash_chunk(key);
- rule_ret = HTTP_RULE_RES_BADREQ;
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_RESOURCE;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
}
case ACT_HTTP_REDIR:
rule_ret = HTTP_RULE_RES_DONE;
if (!http_apply_redirect_rule(rule->arg.redir, s, txn))
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
case ACT_ACTION_TRK_SC0 ... ACT_ACTION_TRK_SCMAX:
switch (rule->action_ptr(rule, px, s->sess, s, act_flags)) {
case ACT_RET_ERR:
- rule_ret = HTTP_RULE_RES_BADREQ;
+ rule_ret = HTTP_RULE_RES_ERROR;
goto end;
case ACT_RET_CONT:
break;