MINOR: proto_http: Remove unused http txn flags
Many flags of the HTTP transction (TX_*) are now unused and useless. So the
flags TX_WAIT_CLEANUP, TX_HDR_CONN_*, TX_CON_CLO_SET and TX_CON_KAL_SET were
removed. Most of TX_CON_WANT_* were also removed. Only TX_CON_WANT_TUN has been
kept.
diff --git a/contrib/debug/flags.c b/contrib/debug/flags.c
index 56602ad..dc4c044 100644
--- a/contrib/debug/flags.c
+++ b/contrib/debug/flags.c
@@ -273,21 +273,8 @@
SHOW_FLAG(f, TX_NOT_FIRST);
SHOW_FLAG(f, TX_USE_PX_CONN);
- SHOW_FLAG(f, TX_HDR_CONN_KAL);
- SHOW_FLAG(f, TX_HDR_CONN_CLO);
- SHOW_FLAG(f, TX_HDR_CONN_PRS);
SHOW_FLAG(f, TX_WAIT_NEXT_RQ);
- SHOW_FLAG(f, TX_HDR_CONN_UPG);
- SHOW_FLAG(f, TX_CON_KAL_SET);
- SHOW_FLAG(f, TX_CON_CLO_SET);
-
- //printf("%s", f ? "" : " | ");
- switch (f & TX_CON_WANT_MSK) {
- case TX_CON_WANT_KAL: /*f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_KAL%s", f ? " | " : "");*/ break;
- case TX_CON_WANT_TUN: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_TUN%s", f ? " | " : ""); break;
- case TX_CON_WANT_SCL: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_SCL%s", f ? " | " : ""); break;
- case TX_CON_WANT_CLO: f &= ~TX_CON_WANT_MSK ; printf("TX_CON_WANT_CLO%s", f ? " | " : ""); break;
- }
+ SHOW_FLAG(f, TX_CON_WANT_TUN);
SHOW_FLAG(f, TX_CACHE_COOK);
SHOW_FLAG(f, TX_CACHEABLE);
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 205bd5f..9d84ef4 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -70,37 +70,16 @@
#define TX_CACHE_IGNORE 0x00004000 /* do not retrieve object from cache */
#define TX_CACHE_SHIFT 12 /* bit shift */
-/* Unused: 0x8000 */
+/* Unused: 0x00008000, 0x00010000, 0x00020000, 0x00080000 */
-#define TX_WAIT_CLEANUP 0x0010000 /* this transaction is waiting for a clean up */
+#define TX_CON_WANT_TUN 0x00100000 /* Will be a tunnel (CONNECT or 101-Switching-Protocol) */
-/* Unused: 0x20000, 0x80000 */
+/* unused: 0x00200000, 0x00400000, 0x00800000, 0x01000000, 0x02000000 */
-
-/* indicate how we *want* the connection to behave, regardless of what is in
- * the headers. We have 4 possible values right now :
- * - WANT_KAL : try to maintain keep-alive (default when nothing configured)
- * - WANT_TUN : will be a tunnel (CONNECT).
- * - WANT_SCL : enforce close on the server side
- * - WANT_CLO : enforce close on both sides
- */
-#define TX_CON_WANT_KAL 0x00000000 /* note: it's important that it is 0 (init) */
-#define TX_CON_WANT_TUN 0x00100000
-#define TX_CON_WANT_SCL 0x00200000
-#define TX_CON_WANT_CLO 0x00300000
-#define TX_CON_WANT_MSK 0x00300000 /* this is the mask to get the bits */
-
-#define TX_CON_CLO_SET 0x00400000 /* "connection: close" is now set */
-#define TX_CON_KAL_SET 0x00800000 /* "connection: keep-alive" is now set */
-
-/* unused: 0x01000000 */
-
-#define TX_HDR_CONN_UPG 0x02000000 /* The "Upgrade" token was found in the "Connection" header */
#define TX_WAIT_NEXT_RQ 0x04000000 /* waiting for the second request to start, use keep-alive timeout */
-#define TX_HDR_CONN_PRS 0x08000000 /* "connection" header already parsed (req or res), results below */
-#define TX_HDR_CONN_CLO 0x10000000 /* "Connection: close" was present at least once */
-#define TX_HDR_CONN_KAL 0x20000000 /* "Connection: keep-alive" was present at least once */
+/* unused: 0x08000000, 0x10000000, 0x20000000 */
+
#define TX_USE_PX_CONN 0x40000000 /* Use "Proxy-Connection" instead of "Connection" */
/* used only for keep-alive purposes, to indicate we're on a second transaction */
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 3517269..88be56e 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -400,9 +400,6 @@
if (unlikely((s->logs.logwait & LW_REQHDR) && s->req_cap))
htx_capture_headers(htx, s->req_cap, sess->fe->req_cap);
- /* by default, close the stream at the end of the transaction. */
- txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_CLO;
-
/* we may have to wait for the request's body */
if (s->be->options & PR_O_WREQ_BODY)
req->analysers |= AN_REQ_HTTP_BODY;
@@ -1242,7 +1239,7 @@
done:
/* other states, DONE...TUNNEL */
/* we don't want to forward closes on DONE except in tunnel mode. */
- if ((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN)
+ if (!(txn->flags & TX_CON_WANT_TUN))
channel_dont_close(req);
if (HAS_REQ_DATA_FILTERS(s)) {
@@ -1275,8 +1272,7 @@
* it can be abused to exhaust source ports. */
if (s->be->options & PR_O_ABRT_CLOSE) {
channel_auto_read(req);
- if ((req->flags & (CF_SHUTR|CF_READ_NULL)) &&
- ((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN))
+ if ((req->flags & (CF_SHUTR|CF_READ_NULL)) && !(txn->flags & TX_CON_WANT_TUN))
s->si[1].flags |= SI_FL_NOLINGER;
channel_auto_close(req);
}
@@ -1751,7 +1747,7 @@
* header which contains information about that protocol for
* responses with status 101 (eg: see RFC2817 about TLS).
*/
- txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_TUN;
+ txn->flags |= TX_CON_WANT_TUN;
}
/* check for NTML authentication headers in 401 (WWW-Authenticate) and
@@ -5142,7 +5138,7 @@
* mode, we'll have to wait for the last bytes to leave in either
* direction, and sometimes for a close to be effective.
*/
- if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_TUN) {
+ if (txn->flags & TX_CON_WANT_TUN) {
/* Tunnel mode will not have any analyser so it needs to
* poll for reads.
*/
@@ -5262,7 +5258,7 @@
* mode, we'll have to wait for the last bytes to leave in either
* direction, and sometimes for a close to be effective.
*/
- if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_TUN) {
+ if (txn->flags & TX_CON_WANT_TUN) {
channel_auto_read(chn);
chn->flags |= CF_NEVER_WAIT;
if (b_data(&chn->buf))