]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: release compression context only in http_end_txn()
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Mar 2014 14:48:55 +0000 (15:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Mar 2014 18:26:20 +0000 (19:26 +0100)
Currently there are two places where the compression context is released,
one in session_free() and another one in http_end_txn_clean_session().
Both of them call http_end_txn(), either directly or via http_reset_txn(),
and this function is made for this exact purpose. So let's centralize the
call there instead.

src/proto_http.c
src/session.c

index 06a03723715baf43f72069aefb734eb6d95d6664..c0be2898979def1214c36a92878d3f8b905cb7c7 100644 (file)
@@ -4448,11 +4448,6 @@ void http_end_txn_clean_session(struct session *s)
        s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST);
        s->flags &= ~(SN_CURR_SESS|SN_REDIRECTABLE|SN_SRV_REUSED);
 
-       if (s->flags & SN_COMP_READY)
-               s->comp_algo->end(&s->comp_ctx);
-       s->comp_algo = NULL;
-       s->flags &= ~SN_COMP_READY;
-
        s->txn.meth = 0;
        http_reset_txn(s);
        s->txn.flags |= TX_NOT_FIRST | TX_WAIT_NEXT_RQ;
@@ -8243,6 +8238,12 @@ void http_end_txn(struct session *s)
 {
        struct http_txn *txn = &s->txn;
 
+       /* release any possible compression context */
+       if (s->flags & SN_COMP_READY)
+               s->comp_algo->end(&s->comp_ctx);
+       s->comp_algo = NULL;
+       s->flags &= ~SN_COMP_READY;
+
        /* these ones will have been dynamically allocated */
        pool_free2(pool2_requri, txn->uri);
        pool_free2(pool2_capture, txn->cli_cookie);
index b3da759b47a6916c1029d39dadd6e17013c89fdd..7eeb6aa5e02c9f3b124df6718b048c2af5a7b34c 100644 (file)
@@ -602,11 +602,6 @@ static void session_free(struct session *s)
                sess_change_server(s, NULL);
        }
 
-       if (s->flags & SN_COMP_READY)
-               s->comp_algo->end(&s->comp_ctx);
-       s->comp_algo = NULL;
-       s->flags &= ~SN_COMP_READY;
-
        if (s->req->pipe)
                put_pipe(s->req->pipe);