]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] session: conn_retries was not always initialized
authorWilly Tarreau <w@1wt.eu>
Sun, 27 Mar 2011 17:16:56 +0000 (19:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 27 Mar 2011 17:16:56 +0000 (19:16 +0200)
Johannes Smith reported some wrong retries count in logs associated with bad
requests. The cause was that the conn_retries field in the stream interface
was only initialized when attempting to connect, but is used when logging,
possibly with an uninitialized value holding last connection's conn_retries.
This could have been avoided by making use of a stream interface initializer.

This bug is 1.5-specific.

src/proto_http.c
src/session.c

index 30177eeeefafaf8c5fff0877183369119f557896..ef6f46ea84a0807f272ec604fc6dd7b902f61d39 100644 (file)
@@ -3987,6 +3987,7 @@ void http_end_txn_clean_session(struct session *s)
        s->req->cons->state     = s->req->cons->prev_state = SI_ST_INI;
        s->req->cons->fd        = -1; /* just to help with debugging */
        s->req->cons->err_type  = SI_ET_NONE;
+       s->req->cons->conn_retries = 0;  /* used for logging too */
        s->req->cons->err_loc   = NULL;
        s->req->cons->exp       = TICK_ETERNITY;
        s->req->cons->flags     = SI_FL_NONE;
index 24df9365e0972ada8192cbf60c088359759c9537..d673aaa63c24dc91a336adf79afc1b08eb3132e3 100644 (file)
@@ -188,6 +188,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        s->si[1].owner     = t;
        s->si[1].state     = s->si[1].prev_state = SI_ST_INI;
        s->si[1].err_type  = SI_ET_NONE;
+       s->si[1].conn_retries = 0;  /* used for logging too */
        s->si[1].err_loc   = NULL;
        s->si[1].connect   = NULL;
        s->si[1].release   = NULL;