mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 09:07:02 +02:00
MINOR: stream-int: add a new flag to mention that we want the connection to be killed
The new flag SI_FL_KILL_CONN is now set by the rare actions which deliberately want the whole connection (and not just the stream) to be killed. This is only used for "tcp-request content reject", "tcp-response content reject", "tcp-response content close" and "http-request reject". The purpose is to desambiguate the close from a regular shutdown. This will be used by the next patches.
This commit is contained in:
parent
4dbda620f2
commit
0f9cd7b196
@ -420,6 +420,12 @@ static inline void si_shutw(struct stream_interface *si)
|
|||||||
si->ops->shutw(si);
|
si->ops->shutw(si);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Marks on the stream-interface that next shutw must kill the whole connection */
|
||||||
|
static inline void si_must_kill_conn(struct stream_interface *si)
|
||||||
|
{
|
||||||
|
si->flags |= SI_FL_KILL_CONN;
|
||||||
|
}
|
||||||
|
|
||||||
/* This is to be used after making some room available in a channel. It will
|
/* This is to be used after making some room available in a channel. It will
|
||||||
* return without doing anything if the stream interface's RX path is blocked.
|
* return without doing anything if the stream interface's RX path is blocked.
|
||||||
* It will automatically mark the stream interface as busy processing the end
|
* It will automatically mark the stream interface as busy processing the end
|
||||||
|
@ -64,7 +64,7 @@ enum {
|
|||||||
SI_FL_NONE = 0x00000000, /* nothing */
|
SI_FL_NONE = 0x00000000, /* nothing */
|
||||||
SI_FL_EXP = 0x00000001, /* timeout has expired */
|
SI_FL_EXP = 0x00000001, /* timeout has expired */
|
||||||
SI_FL_ERR = 0x00000002, /* a non-recoverable error has occurred */
|
SI_FL_ERR = 0x00000002, /* a non-recoverable error has occurred */
|
||||||
/* unused: 0x00000004 */
|
SI_FL_KILL_CONN = 0x00000004, /* next shutw must kill the whole conn, not just the stream */
|
||||||
SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */
|
SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */
|
||||||
SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */
|
SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */
|
||||||
SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */
|
SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <proto/http_rules.h>
|
#include <proto/http_rules.h>
|
||||||
#include <proto/log.h>
|
#include <proto/log.h>
|
||||||
#include <proto/proto_http.h>
|
#include <proto/proto_http.h>
|
||||||
|
#include <proto/stream_interface.h>
|
||||||
|
|
||||||
|
|
||||||
/* This function executes one of the set-{method,path,query,uri} actions. It
|
/* This function executes one of the set-{method,path,query,uri} actions. It
|
||||||
@ -185,6 +186,7 @@ static enum act_parse_ret parse_http_set_status(const char **args, int *orig_arg
|
|||||||
static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
|
static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
|
||||||
struct session *sess, struct stream *s, int flags)
|
struct session *sess, struct stream *s, int flags)
|
||||||
{
|
{
|
||||||
|
si_must_kill_conn(chn_prod(&s->req));
|
||||||
channel_abort(&s->req);
|
channel_abort(&s->req);
|
||||||
channel_abort(&s->res);
|
channel_abort(&s->res);
|
||||||
s->req.analysers = 0;
|
s->req.analysers = 0;
|
||||||
|
@ -163,6 +163,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (rule->action == ACT_ACTION_DENY) {
|
else if (rule->action == ACT_ACTION_DENY) {
|
||||||
|
si_must_kill_conn(chn_prod(req));
|
||||||
channel_abort(req);
|
channel_abort(req);
|
||||||
channel_abort(&s->res);
|
channel_abort(&s->res);
|
||||||
req->analysers = 0;
|
req->analysers = 0;
|
||||||
@ -342,6 +343,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (rule->action == ACT_ACTION_DENY) {
|
else if (rule->action == ACT_ACTION_DENY) {
|
||||||
|
si_must_kill_conn(chn_prod(rep));
|
||||||
channel_abort(rep);
|
channel_abort(rep);
|
||||||
channel_abort(&s->req);
|
channel_abort(&s->req);
|
||||||
rep->analysers = 0;
|
rep->analysers = 0;
|
||||||
@ -359,6 +361,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
}
|
}
|
||||||
else if (rule->action == ACT_TCP_CLOSE) {
|
else if (rule->action == ACT_TCP_CLOSE) {
|
||||||
chn_prod(rep)->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
|
chn_prod(rep)->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
|
||||||
|
si_must_kill_conn(chn_prod(rep));
|
||||||
si_shutr(chn_prod(rep));
|
si_shutr(chn_prod(rep));
|
||||||
si_shutw(chn_prod(rep));
|
si_shutw(chn_prod(rep));
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user