]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] http: the transaction must be initialized even in TCP mode (part 2)
authorWilly Tarreau <w@1wt.eu>
Mon, 31 May 2010 15:01:36 +0000 (17:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 4 Jun 2010 12:37:05 +0000 (14:37 +0200)
Commit 4605e3b641cebbdbb2ee5726e5bbc3c03a2d7b5e was not enough, because
connections passing from a TCP frontend to an HTTP backend without any
ACL and via a "default_backend" statement were still working on non-initialized
data. An initialization was missing in the session_set_backend() function, next
to the initialization of hdr_idx.

src/proxy.c

index 57506d9da59e113733570445a40a18e78489e0af..1ee4d6d057a3f0d08f25f1f0b4fe8f91ae6ee34b 100644 (file)
@@ -34,6 +34,7 @@
 #include <proto/log.h>
 #include <proto/protocols.h>
 #include <proto/proto_tcp.h>
+#include <proto/proto_http.h>
 #include <proto/proxy.h>
 
 
@@ -736,6 +737,10 @@ int session_set_backend(struct session *s, struct proxy *be)
        if (unlikely(!s->txn.hdr_idx.v && (be->acl_requires & ACL_USE_L7_ANY))) {
                if ((s->txn.hdr_idx.v = pool_alloc2(s->fe->hdr_idx_pool)) == NULL)
                        return 0; /* not enough memory */
+
+               /* and now initialize the HTTP transaction state */
+               http_init_txn(s);
+
                s->txn.hdr_idx.size = MAX_HTTP_HDR;
                hdr_idx_init(&s->txn.hdr_idx);
        }