[MINOR] move some flags from session.h to proto_http.h
Some session flags were clearly related to HTTP transactions.
A new 'flags' field has been added to http_txn, and the
associated flags moved to proto_http.h.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 297c5b9..298d30d 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -82,6 +82,15 @@
int stats_check_uri_auth(struct session *t, struct proxy *backend);
void init_proto_http();
+/* used to clear the cookie flags when a transaction failed on the server
+ * designed by the cookie. We clear the CK_VALID bit and set the CK_DOWN.
+ */
+static inline void http_flush_cookie_flags(struct http_txn *txn)
+{
+ if ((txn->flags & TX_CK_MASK) == TX_CK_VALID)
+ txn->flags ^= (TX_CK_VALID | TX_CK_DOWN);
+}
+
#endif /* _PROTO_PROTO_HTTP_H */
/*
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 58a89ff..a6709aa 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -53,6 +53,41 @@
#define SV_STSHUTW 5
#define SV_STCLOSE 6
+/*
+ * Transaction flags moved from session
+ */
+
+
+/* action flags */
+#define TX_CLDENY 0x00000001 /* a client header matches a deny regex */
+#define TX_CLALLOW 0x00000002 /* a client header matches an allow regex */
+#define TX_SVDENY 0x00000004 /* a server header matches a deny regex */
+#define TX_SVALLOW 0x00000008 /* a server header matches an allow regex */
+#define TX_CLTARPIT 0x00000010 /* the session is tarpitted (anti-dos) */
+/* unused: 0x00000020 */
+
+/* transaction flags dedicated to cookies : bits values 0x40, 0x80 (0-3 shift 6) */
+#define TX_CK_NONE 0x00000000 /* this session had no cookie */
+#define TX_CK_INVALID 0x00000040 /* this session had a cookie which matches no server */
+#define TX_CK_DOWN 0x00000080 /* this session had cookie matching a down server */
+#define TX_CK_VALID 0x000000C0 /* this session had cookie matching a valid server */
+#define TX_CK_MASK 0x000000C0 /* mask to get this session's cookie flags */
+#define TX_CK_SHIFT 6 /* bit shift */
+
+/* cookie information, bits values 0x100 to 0x800 (0-8 shift 8) */
+#define TX_SCK_NONE 0x00000000 /* no set-cookie seen for the server cookie */
+#define TX_SCK_DELETED 0x00000100 /* existing set-cookie deleted or changed */
+#define TX_SCK_INSERTED 0x00000200 /* new set-cookie inserted or changed existing one */
+#define TX_SCK_SEEN 0x00000400 /* set-cookie seen for the server cookie */
+#define TX_SCK_MASK 0x00000700 /* mask to get the set-cookie field */
+#define TX_SCK_ANY 0x00000800 /* at least one set-cookie seen (not to be counted) */
+#define TX_SCK_SHIFT 8 /* bit shift */
+
+/* cacheability management, bits values 0x1000 to 0x3000 (0-3 shift 12) */
+#define TX_CACHEABLE 0x00001000 /* at least part of the response is cacheable */
+#define TX_CACHE_COOK 0x00002000 /* a cookie in the response is cacheable */
+#define TX_CACHE_SHIFT 12 /* bit shift */
+
/* The HTTP parser is more complex than it looks like, because we have to
* support multi-line headers and any number of spaces between the colon and
@@ -204,6 +239,7 @@
char *cli_cookie; /* cookie presented by the client, in capture mode */
char *srv_cookie; /* cookie presented by the server, in capture mode */
int status; /* HTTP status from the server, negative if from proxy */
+ unsigned int flags; /* transaction flags */
};
diff --git a/include/types/session.h b/include/types/session.h
index 99f8819..1011c9a 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -41,19 +41,13 @@
/* various session flags, bits values 0x01 to 0x20 (shift 0) */
#define SN_DIRECT 0x00000001 /* connection made on the server matching the client cookie */
-#define SN_CLDENY 0x00000002 /* a client header matches a deny regex */
-#define SN_CLALLOW 0x00000004 /* a client header matches an allow regex */
-#define SN_SVDENY 0x00000008 /* a server header matches a deny regex */
-#define SN_SVALLOW 0x00000010 /* a server header matches an allow regex */
-#define SN_BE_ASSIGNED 0x00000020 /* a backend was assigned. Conns are accounted. */
-
-/* session flags dedicated to cookies : bits values 0x40, 0x80 (0-3 shift 6) */
-#define SN_CK_NONE 0x00000000 /* this session had no cookie */
-#define SN_CK_INVALID 0x00000040 /* this session had a cookie which matches no server */
-#define SN_CK_DOWN 0x00000080 /* this session had cookie matching a down server */
-#define SN_CK_VALID 0x000000C0 /* this session had cookie matching a valid server */
-#define SN_CK_MASK 0x000000C0 /* mask to get this session's cookie flags */
-#define SN_CK_SHIFT 6 /* bit shift */
+#define SN_ASSIGNED 0x00000002 /* no need to assign a server to this session */
+#define SN_ADDR_SET 0x00000004 /* this session's server address has been set */
+#define SN_BE_ASSIGNED 0x00000008 /* a backend was assigned. Conns are accounted. */
+#define SN_CONN_CLOSED 0x00000010 /* "Connection: close" was present or added */
+#define SN_MONITOR 0x00000020 /* this session comes from a monitoring system */
+#define SN_SELF_GEN 0x00000040 /* the proxy generates data for the client (eg: stats) */
+/* unused: 0x00000080 */
/* session termination conditions, bits values 0x100 to 0x700 (0-7 shift 8) */
#define SN_ERR_NONE 0x00000000
@@ -66,6 +60,7 @@
#define SN_ERR_INTERNAL 0x00000700 /* the proxy encountered an internal error */
#define SN_ERR_MASK 0x00000700 /* mask to get only session error flags */
#define SN_ERR_SHIFT 8 /* bit shift */
+/* unused: 0x00000800 */
/* session state at termination, bits values 0x1000 to 0x7000 (0-7 shift 12) */
#define SN_FINST_R 0x00001000 /* session ended during client request */
@@ -77,28 +72,7 @@
#define SN_FINST_T 0x00007000 /* session ended tarpitted */
#define SN_FINST_MASK 0x00007000 /* mask to get only final session state flags */
#define SN_FINST_SHIFT 12 /* bit shift */
-
-/* cookie information, bits values 0x10000 to 0x80000 (0-8 shift 16) */
-#define SN_SCK_NONE 0x00000000 /* no set-cookie seen for the server cookie */
-#define SN_SCK_DELETED 0x00010000 /* existing set-cookie deleted or changed */
-#define SN_SCK_INSERTED 0x00020000 /* new set-cookie inserted or changed existing one */
-#define SN_SCK_SEEN 0x00040000 /* set-cookie seen for the server cookie */
-#define SN_SCK_MASK 0x00070000 /* mask to get the set-cookie field */
-#define SN_SCK_ANY 0x00080000 /* at least one set-cookie seen (not to be counted) */
-#define SN_SCK_SHIFT 16 /* bit shift */
-
-/* cacheability management, bits values 0x100000 to 0x300000 (0-3 shift 20) */
-#define SN_CACHEABLE 0x00100000 /* at least part of the response is cacheable */
-#define SN_CACHE_COOK 0x00200000 /* a cookie in the response is cacheable */
-#define SN_CACHE_SHIFT 20 /* bit shift */
-
-/* various other session flags, bits values 0x400000 and above */
-#define SN_CONN_CLOSED 0x00000800 /* "Connection: close" was present or added */
-#define SN_MONITOR 0x00400000 /* this session comes from a monitoring system */
-#define SN_ASSIGNED 0x00800000 /* no need to assign a server to this session */
-#define SN_ADDR_SET 0x01000000 /* this session's server address has been set */
-#define SN_SELF_GEN 0x02000000 /* the proxy generates data for the client (eg: stats) */
-#define SN_CLTARPIT 0x04000000 /* the session is tarpitted (anti-dos) */
+/* unused: 0x00008000 */
/* WARNING: if new fields are added, they must be initialized in event_accept()