[MINOR] http: move appsession 'sessid' from session to http_txn

This change, suggested by Cyril Bonté, makes a lot of sense and
would have made it obvious that sessid was not properly initialized
while switching to keep-alive. The code is now cleaner.
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index a0622b7..c68b0c9 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -311,6 +311,7 @@
 	char *uri;			/* first line if log needed, NULL otherwise */
 	char *cli_cookie;		/* cookie presented by the client, in capture mode */
 	char *srv_cookie;		/* cookie presented by the server, in capture mode */
+	char *sessid;                   /* the appsession id, if found in the request or in the response */
 	int status;			/* HTTP status from the server, negative if from proxy */
 	unsigned int flags;             /* transaction flags */
 };
diff --git a/include/types/session.h b/include/types/session.h
index 1af52ce..a8ec1e3 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -163,7 +163,6 @@
 	int conn_retries;			/* number of connect retries left */
 	int flags;				/* some flags describing the session */
 	unsigned term_trace;			/* term trace: 4*8 bits indicating which part of the code closed */
-	char *sessid;				/* the session id, if found in the request or in the response */
 	struct buffer *req;			/* request buffer */
 	struct buffer *rep;			/* response buffer */
 	struct stream_interface si[2];          /* client and server stream interfaces */
diff --git a/src/client.c b/src/client.c
index 866fc87..b0184bb 100644
--- a/src/client.c
+++ b/src/client.c
@@ -185,7 +185,6 @@
 		s->be = s->fe = p;
 
 		s->req = s->rep = NULL; /* will be allocated later */
-		s->sessid = NULL;
 
 		s->si[0].state = s->si[0].prev_state = SI_ST_EST;
 		s->si[0].err_type = SI_ET_NONE;
@@ -263,6 +262,7 @@
 		 * session.c:session_free(). It is important that they are
 		 * properly initialized.
 		 */
+		txn->sessid = NULL;
 		txn->srv_cookie = NULL;
 		txn->cli_cookie = NULL;
 		txn->uri = NULL;
diff --git a/src/proto_http.c b/src/proto_http.c
index 92c5869..bb7da5d 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2988,7 +2988,7 @@
 	 */
 
 	/* It needs to look into the URI */
-	if ((s->sessid == NULL) && s->be->appsession_name) {
+	if ((txn->sessid == NULL) && s->be->appsession_name) {
 		get_srv_from_appsession(s, msg->sol + msg->sl.rq.u, msg->sl.rq.u_l);
 	}
 
@@ -5174,19 +5174,19 @@
 
 	if (t->be->options2 & PR_O2_AS_REQL) {
 		/* request-learn option is enabled : store the sessid in the session for future use */
-		if (t->sessid != NULL) {
+		if (txn->sessid != NULL) {
 			/* free previously allocated memory as we don't need the session id found in the URL anymore */
-			pool_free2(apools.sessid, t->sessid);
+			pool_free2(apools.sessid, txn->sessid);
 		}
 
-		if ((t->sessid = pool_alloc2(apools.sessid)) == NULL) {
+		if ((txn->sessid = pool_alloc2(apools.sessid)) == NULL) {
 			Alert("Not enough memory process_cli():asession->sessid:malloc().\n");
 			send_log(t->be, LOG_ALERT, "Not enough memory process_cli():asession->sessid:malloc().\n");
 			return;
 		}
 
-		memcpy(t->sessid, buf, len);
-		t->sessid[len] = 0;
+		memcpy(txn->sessid, buf, len);
+		txn->sessid[len] = 0;
 	}
 
 	if ((sessid_temp = pool_alloc2(apools.sessid)) == NULL) {
@@ -5921,18 +5921,18 @@
 
 				if (memcmp(p1, t->be->appsession_name, cmp_len) == 0) {
 					/* Cool... it's the right one */
-					if (t->sessid != NULL) {
+					if (txn->sessid != NULL) {
 						/* free previously allocated memory as we don't need it anymore */
-						pool_free2(apools.sessid, t->sessid);
+						pool_free2(apools.sessid, txn->sessid);
 					}
 					/* Store the sessid in the session for future use */
-					if ((t->sessid = pool_alloc2(apools.sessid)) == NULL) {
+					if ((txn->sessid = pool_alloc2(apools.sessid)) == NULL) {
 						Alert("Not enough Memory process_srv():asession->sessid:malloc().\n");
 						send_log(t->be, LOG_ALERT, "Not enough Memory process_srv():asession->sessid:malloc().\n");
 						return;
 					}
-					memcpy(t->sessid, value_begin, value_len);
-					t->sessid[value_len] = 0;
+					memcpy(txn->sessid, value_begin, value_len);
+					txn->sessid[value_len] = 0;
 				}
 			} /* end if ((t->be->appsession_name != NULL) ... */
 			break; /* we don't want to loop again since there cannot be another cookie on the same line */
@@ -5941,10 +5941,10 @@
 		old_idx = cur_idx;
 	} /* end of cookie processing on this header */
 
-	if (t->sessid != NULL) {
+	if (txn->sessid != NULL) {
 		appsess *asession = NULL;
 		/* only do insert, if lookup fails */
-		asession = appsession_hash_lookup(&(t->be->htbl_proxy), t->sessid);
+		asession = appsession_hash_lookup(&(t->be->htbl_proxy), txn->sessid);
 		if (asession == NULL) {
 			size_t server_id_len;
 			if ((asession = pool_alloc2(pool2_appsess)) == NULL) {
@@ -5958,7 +5958,7 @@
 				t->be->htbl_proxy.destroy(asession);
 				return;
 			}
-			memcpy(asession->sessid, t->sessid, t->be->appsession_len);
+			memcpy(asession->sessid, txn->sessid, t->be->appsession_len);
 			asession->sessid[t->be->appsession_len] = 0;
 
 			server_id_len = strlen(t->srv->id) + 1;
@@ -6362,8 +6362,8 @@
 	pool_free2(pool2_requri, txn->uri);
 	pool_free2(pool2_capture, txn->cli_cookie);
 	pool_free2(pool2_capture, txn->srv_cookie);
-	pool_free2(apools.sessid, s->sessid);
-	s->sessid = NULL;
+	pool_free2(apools.sessid, txn->sessid);
+	txn->sessid = NULL;
 	txn->uri = NULL;
 	txn->srv_cookie = NULL;
 	txn->cli_cookie = NULL;