]> git.kaiwu.me - haproxy.git/commitdiff
[BUG] appsession lookup in URL does not work
authorRyan Warnick <warnickr_1@isp01.net>
Sun, 17 Feb 2008 10:24:35 +0000 (11:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 8 Mar 2008 20:51:46 +0000 (21:51 +0100)
We've been trying to use the latest release (1.3.14.2) of haproxy  to do
sticky sessions.  Cookie insertion is not an option for us, although we
would much rather use it, as we are trying to work around a problem where
cookies are unreliable.  The appsession functionality only partially worked
(it wouldn't read the session id out of a query string) until we made the
following code change to the get_srv_from_appsession function in
proto_http.c.
(cherry picked from commit 6d0b1fac23517f16b3972b529ea41718b3643c9f)

src/proto_http.c

index 9f016af41c813c14cdffc9e49e74a8b2af9d7aa8..db37035d77ef464837e3b6725bf10da805d4df6f 100644 (file)
@@ -4439,7 +4439,8 @@ void manage_server_side_cookies(struct session *t, struct buffer *rtr)
                                asession_temp->serverid = NULL;
 
                                /* only do insert, if lookup fails */
-                               if (appsession_hash_lookup(&(t->be->htbl_proxy), asession_temp->sessid) == NULL) {
+                               asession_temp = appsession_hash_lookup(&(t->be->htbl_proxy), asession_temp->sessid);
+                               if (asession_temp == NULL) {
                                        if ((asession_temp = pool_alloc2(pool2_appsess)) == NULL) {
                                                Alert("Not enough Memory process_srv():asession:calloc().\n");
                                                send_log(t->be, LOG_ALERT, "Not enough Memory process_srv():asession:calloc().\n");
@@ -4610,7 +4611,8 @@ void get_srv_from_appsession(struct session *t, const char *begin, int len)
        asession_temp->serverid = NULL;
        
        /* only do insert, if lookup fails */
-       if (appsession_hash_lookup(&(t->be->htbl_proxy), asession_temp->sessid) == NULL) {
+       asession_temp = appsession_hash_lookup(&(t->be->htbl_proxy), asession_temp->sessid);
+       if (asession_temp == NULL) {
                if ((asession_temp = pool_alloc2(pool2_appsess)) == NULL) {
                        /* free previously allocated memory */
                        pool_free2(apools.sessid, local_asession.sessid);