MINOR: proto_htx: Don't adjust transaction mode anymore in HTX analyzers
Because the option http-tunnel is now ignored in HTX, there is no longer any
need to adjust the transaction mode in HTX analyzers. A channel can still be
switch to the tunnel mode for legitimate cases (HTTP CONNECT or switching
protocols). So the function htx_adjust_conn_mode() is now useless.
This patch must be backported to 1.9. It is not strictly speaking required but
it will ease futur backports.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 2e2163e..eecd9a7 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -80,7 +80,6 @@
int htx_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px);
int htx_request_forward_body(struct stream *s, struct channel *req, int an_bit);
int htx_response_forward_body(struct stream *s, struct channel *res, int an_bit);
-void htx_adjust_conn_mode(struct stream *s, struct http_txn *txn);
int htx_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn);
int htx_transform_header_str(struct stream* s, struct channel *chn, struct htx *htx,
struct ist name, const char *str, struct my_regex *re, int action);
diff --git a/src/proto_http.c b/src/proto_http.c
index 0a91091..e68b0e2 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -495,7 +495,7 @@
int tmp = TX_CON_WANT_KAL;
if (IS_HTX_STRM(s))
- return htx_adjust_conn_mode(s, txn);
+ return;
if ((fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN)
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 2ec1dc4..3387943 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -409,18 +409,8 @@
if (unlikely((s->logs.logwait & LW_REQHDR) && s->req_cap))
htx_capture_headers(htx, s->req_cap, sess->fe->req_cap);
- /* Until set to anything else, the connection mode is set as Keep-Alive. It will
- * only change if both the request and the config reference something else.
- * Option httpclose by itself sets tunnel mode where headers are mangled.
- * However, if another mode is set, it will affect it (eg: server-close/
- * keep-alive + httpclose = close). Note that we avoid to redo the same work
- * if FE and BE have the same settings (common). The method consists in
- * checking if options changed between the two calls (implying that either
- * one is non-null, or one of them is non-null and we are there for the first
- * time.
- */
- if ((sess->fe->options & PR_O_HTTP_MODE) != (s->be->options & PR_O_HTTP_MODE))
- htx_adjust_conn_mode(s, txn);
+ /* 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)
@@ -2296,14 +2286,6 @@
return 0;
}
-void htx_adjust_conn_mode(struct stream *s, struct http_txn *txn)
-{
- int tmp = TX_CON_WANT_CLO;
-
- if ((txn->flags & TX_CON_WANT_MSK) < tmp)
- txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | tmp;
-}
-
/* Perform an HTTP redirect based on the information in <rule>. The function
* returns zero on success, or zero in case of a, irrecoverable error such
* as too large a request to build a valid response.