MEDIUM: log: add a new cookie flag 'U' to report situations where cookie is not used

This happens when a "use-server" rule sets the server instead.
This commit is contained in:
Willy Tarreau 2012-04-05 21:18:22 +02:00
parent 4a5cadea40
commit c89ccb6221
4 changed files with 11 additions and 3 deletions

View File

@ -9184,6 +9184,10 @@ each of which has a special meaning :
the cookie is consider too OLD and is ignored. The request will be the cookie is consider too OLD and is ignored. The request will be
redispatched just as if there was no cookie. redispatched just as if there was no cookie.
U : a cookie was present but was not used to select the server because
some other server selection mechanism was used instead (typically a
"use-server" rule).
- : does not apply (no cookie set in configuration). - : does not apply (no cookie set in configuration).
- the last character reports what operations were performed on the persistence - the last character reports what operations were performed on the persistence

View File

@ -43,6 +43,7 @@
#define TX_CK_VALID 0x00000060 /* this session had cookie matching a valid server */ #define TX_CK_VALID 0x00000060 /* this session had cookie matching a valid server */
#define TX_CK_EXPIRED 0x00000080 /* this session had an expired cookie (idle for too long) */ #define TX_CK_EXPIRED 0x00000080 /* this session had an expired cookie (idle for too long) */
#define TX_CK_OLD 0x000000A0 /* this session had too old a cookie (offered too long ago) */ #define TX_CK_OLD 0x000000A0 /* this session had too old a cookie (offered too long ago) */
#define TX_CK_UNUSED 0x000000C0 /* this session had a cookie but it was not used (eg: use-server was preferred) */
#define TX_CK_MASK 0x000000E0 /* mask to get this session's cookie flags */ #define TX_CK_MASK 0x000000E0 /* mask to get this session's cookie flags */
#define TX_CK_SHIFT 5 /* bit shift */ #define TX_CK_SHIFT 5 /* bit shift */

View File

@ -688,7 +688,7 @@ extern fd_set hdr_encode_map[];
extern fd_set url_encode_map[]; extern fd_set url_encode_map[];
const char sess_cookie[8] = "NIDVEO67"; /* No cookie, Invalid cookie, cookie for a Down server, Valid cookie, Expired cookie, Old cookie, unknown */ const char sess_cookie[8] = "NIDVEOU7"; /* No cookie, Invalid cookie, cookie for a Down server, Valid cookie, Expired cookie, Old cookie, Unused, unknown */
const char sess_set_cookie[8] = "NPDIRU67"; /* No set-cookie, Set-cookie found and left unchanged (passive), const char sess_set_cookie[8] = "NPDIRU67"; /* No set-cookie, Set-cookie found and left unchanged (passive),
Set-cookie Deleted, Set-Cookie Inserted, Set-cookie Rewritten, Set-cookie Deleted, Set-Cookie Inserted, Set-cookie Rewritten,
Set-cookie Updated, unknown, unknown */ Set-cookie Updated, unknown, unknown */

View File

@ -6249,9 +6249,12 @@ void manage_client_side_cookies(struct session *t, struct buffer *req)
} }
if (!srv && !(txn->flags & (TX_CK_DOWN|TX_CK_EXPIRED|TX_CK_OLD))) { if (!srv && !(txn->flags & (TX_CK_DOWN|TX_CK_EXPIRED|TX_CK_OLD))) {
/* no server matched this cookie */ /* no server matched this cookie or we deliberately skipped it */
txn->flags &= ~TX_CK_MASK; txn->flags &= ~TX_CK_MASK;
txn->flags |= TX_CK_INVALID; if ((t->flags & (SN_IGNORE_PRST | SN_ASSIGNED)))
txn->flags |= TX_CK_UNUSED;
else
txn->flags |= TX_CK_INVALID;
} }
/* depending on the cookie mode, we may have to either : /* depending on the cookie mode, we may have to either :