mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-10 13:02:44 +02:00
[REORG] session: move the data_ctx struct to the stream interface's applet
This is in fact where those parts belong to. The old data_state was replaced by applet.state and is now initialized when the applet is registered. It's worth noting that the applet does not need to know the session nor the buffer anymore since everything is brought by the stream interface. It is possible that having a separate applet struct would simplify the code but that's not a big deal.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include <types/buffers.h>
|
||||
#include <types/session.h>
|
||||
|
||||
/* Flags for session->data_ctx.stats.flags */
|
||||
/* Flags for applet.ctx.stats.flags */
|
||||
#define STAT_FMT_CSV 0x00000001 /* dump the stats in CSV format instead of HTML */
|
||||
#define STAT_SHOW_STAT 0x00000002 /* dump the stats part */
|
||||
#define STAT_SHOW_INFO 0x00000004 /* dump the info part */
|
||||
|
||||
@@ -81,7 +81,7 @@ void manage_client_side_appsession(struct session *t, const char *buf, int len);
|
||||
void manage_client_side_cookies(struct session *t, struct buffer *req);
|
||||
void manage_server_side_cookies(struct session *t, struct buffer *rtr);
|
||||
void check_response_for_cacheability(struct session *t, struct buffer *rtr);
|
||||
int stats_check_uri(struct session *s, struct proxy *backend);
|
||||
int stats_check_uri(struct stream_interface *si, struct http_txn *txn, struct proxy *backend);
|
||||
void init_proto_http();
|
||||
int http_find_header2(const char *name, int len,
|
||||
char *sol, struct hdr_idx *idx,
|
||||
|
||||
@@ -186,28 +186,6 @@
|
||||
#define HTTP_MSG_CLOSED 35 // shutdown_w done, all bytes sent
|
||||
#define HTTP_MSG_TUNNEL 36 // tunneled data after DONE
|
||||
|
||||
/* data transmission states for the stats responses */
|
||||
enum {
|
||||
DATA_ST_INIT = 0,
|
||||
DATA_ST_HEAD,
|
||||
DATA_ST_INFO,
|
||||
DATA_ST_LIST,
|
||||
DATA_ST_END,
|
||||
DATA_ST_FIN,
|
||||
};
|
||||
|
||||
/* data transmission states for the stats responses inside a proxy */
|
||||
enum {
|
||||
DATA_ST_PX_INIT = 0,
|
||||
DATA_ST_PX_TH,
|
||||
DATA_ST_PX_FE,
|
||||
DATA_ST_PX_LI,
|
||||
DATA_ST_PX_SV,
|
||||
DATA_ST_PX_BE,
|
||||
DATA_ST_PX_END,
|
||||
DATA_ST_PX_FIN,
|
||||
};
|
||||
|
||||
/* Redirect flags */
|
||||
enum {
|
||||
REDIRECT_FLAG_NONE = 0,
|
||||
|
||||
@@ -203,44 +203,6 @@ struct session {
|
||||
void (*do_log)(struct session *s); /* the function to call in order to log (or NULL) */
|
||||
void (*srv_error)(struct session *s, /* the function to call upon unrecoverable server errors (or NULL) */
|
||||
struct stream_interface *si);
|
||||
short int data_state; /* where to get the data we generate ourselves */
|
||||
union {
|
||||
struct {
|
||||
struct proxy *px;
|
||||
struct server *sv;
|
||||
struct listener *l;
|
||||
short px_st, sv_st; /* DATA_ST_INIT or DATA_ST_DATA */
|
||||
unsigned int flags; /* STAT_* */
|
||||
int iid, type, sid; /* proxy id, type and service id if bounding of stats is enabled */
|
||||
const char *st_code; /* pointer to the status code returned by an action */
|
||||
} stats;
|
||||
struct {
|
||||
struct bref bref; /* back-reference from the session being dumped */
|
||||
void *target; /* session we want to dump, or NULL for all */
|
||||
unsigned int uid; /* if non-null, the uniq_id of the session being dumped */
|
||||
int section; /* section of the session being dumped */
|
||||
int pos; /* last position of the current session's buffer */
|
||||
} sess;
|
||||
struct {
|
||||
int iid; /* if >= 0, ID of the proxy to filter on */
|
||||
struct proxy *px; /* current proxy being dumped, NULL = not started yet. */
|
||||
unsigned int buf; /* buffer being dumped, 0 = req, 1 = rep */
|
||||
unsigned int sid; /* session ID of error being dumped */
|
||||
int ptr; /* <0: headers, >=0 : text pointer to restart from */
|
||||
int bol; /* pointer to beginning of current line */
|
||||
} errors;
|
||||
struct {
|
||||
void *target; /* table we want to dump, or NULL for all */
|
||||
struct proxy *proxy; /* table being currently dumped (first if NULL) */
|
||||
struct stksess *entry; /* last entry we were trying to dump (or first if NULL) */
|
||||
long long value; /* value to compare against */
|
||||
signed char data_type; /* type of data to compare, or -1 if none */
|
||||
signed char data_op; /* operator (STD_OP_*) when data_type set */
|
||||
} table;
|
||||
struct {
|
||||
const char *msg; /* pointer to a persistent message to be returned in PRINT state */
|
||||
} cli;
|
||||
} data_ctx; /* used by stats I/O handlers to dump the stats */
|
||||
unsigned int uniq_id; /* unique ID used for the traces */
|
||||
};
|
||||
|
||||
|
||||
@@ -136,8 +136,46 @@ struct stream_interface {
|
||||
int conn_retries; /* number of connect retries left */
|
||||
int fd; /* file descriptor for a stream driver when known */
|
||||
struct {
|
||||
int state; /* applet state, initialized to zero */
|
||||
void *private; /* may be used by any function above */
|
||||
unsigned int st0, st1; /* may be used by any function above */
|
||||
union {
|
||||
struct {
|
||||
struct proxy *px;
|
||||
struct server *sv;
|
||||
struct listener *l;
|
||||
int px_st; /* STAT_PX_ST* */
|
||||
unsigned int flags; /* STAT_* */
|
||||
int iid, type, sid; /* proxy id, type and service id if bounding of stats is enabled */
|
||||
const char *st_code; /* pointer to the status code returned by an action */
|
||||
} stats;
|
||||
struct {
|
||||
struct bref bref; /* back-reference from the session being dumped */
|
||||
void *target; /* session we want to dump, or NULL for all */
|
||||
unsigned int uid; /* if non-null, the uniq_id of the session being dumped */
|
||||
int section; /* section of the session being dumped */
|
||||
int pos; /* last position of the current session's buffer */
|
||||
} sess;
|
||||
struct {
|
||||
int iid; /* if >= 0, ID of the proxy to filter on */
|
||||
struct proxy *px; /* current proxy being dumped, NULL = not started yet. */
|
||||
unsigned int buf; /* buffer being dumped, 0 = req, 1 = rep */
|
||||
unsigned int sid; /* session ID of error being dumped */
|
||||
int ptr; /* <0: headers, >=0 : text pointer to restart from */
|
||||
int bol; /* pointer to beginning of current line */
|
||||
} errors;
|
||||
struct {
|
||||
void *target; /* table we want to dump, or NULL for all */
|
||||
struct proxy *proxy; /* table being currently dumped (first if NULL) */
|
||||
struct stksess *entry; /* last entry we were trying to dump (or first if NULL) */
|
||||
long long value; /* value to compare against */
|
||||
signed char data_type; /* type of data to compare, or -1 if none */
|
||||
signed char data_op; /* operator (STD_OP_*) when data_type set */
|
||||
} table;
|
||||
struct {
|
||||
const char *msg; /* pointer to a persistent message to be returned in PRINT state */
|
||||
} cli;
|
||||
} ctx; /* used by stats I/O handlers to dump the stats */
|
||||
} applet;
|
||||
union {
|
||||
struct {
|
||||
|
||||
Reference in New Issue
Block a user