]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proto_htx: Don't adjust transaction mode anymore in HTX analyzers
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 Mar 2019 21:02:00 +0000 (22:02 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Apr 2019 20:06:53 +0000 (22:06 +0200)
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.

include/proto/proto_http.h
src/proto_http.c
src/proto_htx.c

index 2e2163ee5db03e49e4dd7861cad78a20728d9bf5..eecd9a77150f44fb43a24a5cd177f847c60fe061 100644 (file)
@@ -80,7 +80,6 @@ int htx_wait_for_response(struct stream *s, struct channel *rep, int an_bit);
 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);
index 0a91091b25403e552b1b79f281ab8e14e256b839..e68b0e2f5224fff73a281eee13373d6f252bfe04 100644 (file)
@@ -495,7 +495,7 @@ void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_m
        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)
index 2ec1dc4d9d12ed283dad7e1d351f7bfb90889734..33879438a819100d54b7168f5303f5a2907f651c 100644 (file)
@@ -409,18 +409,8 @@ int htx_wait_for_request(struct stream *s, struct channel *req, int an_bit)
        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 @@ int htx_response_forward_body(struct stream *s, struct channel *res, int an_bit)
        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.