]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: proto_http: smp_prefetch_http initialize txn
authorThierry FOURNIER <tfournier@arpalert.org>
Thu, 24 Sep 2015 06:40:18 +0000 (08:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 25 Sep 2015 21:27:23 +0000 (23:27 +0200)
When we call the function smp_prefetch_http(), if the txn is not initialized,
it doesn't work. This patch fix this. Now, smp_prefecth_http() permits to use
http with any proxy mode.

src/proto_http.c

index 9acf0a2eb76eb14591fa47a14ab5338a21ca5336..44a5d4b6667c9898bfd89a994a19e20e511ad034 100644 (file)
@@ -10031,10 +10031,12 @@ int smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
 
        if (!s)
                return 0;
+       if (!s->txn) {
+               if (unlikely(!http_alloc_txn(s)))
+                       return 0; /* not enough memory */
+               http_init_txn(s);
+       }
        txn = s->txn;
-
-       if (!txn)
-               return 0;
        msg = &txn->req;
 
        /* Check for a dependency on a request */