REORG/MAJOR: session: rename the "session" entity to "stream"

With HTTP/2, we'll have to support multiplexed streams. A stream is in
fact the largest part of what we currently call a session, it has buffers,
logs, etc.

In order to catch any error, this commit removes any reference to the
struct session and tries to rename most "session" occurrences in function
names to "stream" and "sess" to "strm" when that's related to a session.

The files stream.{c,h} were added and session.{c,h} removed.

The session will be reintroduced later and a few parts of the stream
will progressively be moved overthere. It will more or less contain
only what we need in an embryonic session.

Sample fetch functions and converters will have to change a bit so
that they'll use an L5 (session) instead of what's currently called
"L4" which is in fact L6 for now.

Once all changes are completed, we should see approximately this :

   L7 - http_txn
   L6 - stream
   L5 - session
   L4 - connection | applet

There will be at most one http_txn per stream, and a same session will
possibly be referenced by multiple streams. A connection will point to
a session and to a stream. The session will hold all the information
we need to keep even when we don't yet have a stream.

Some more cleanup is needed because some code was already far from
being clean. The server queue management still refers to sessions at
many places while comments talk about connections. This will have to
be cleaned up once we have a server-side connection pool manager.
Stream flags "SN_*" still need to be renamed, it doesn't seem like
any of them will need to move to the session.
diff --git a/src/acl.c b/src/acl.c
index d8b3000..edf1339 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1097,7 +1097,7 @@
  *     if (cond->pol == ACL_COND_UNLESS)
  *         res = !res;
  */
-enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, void *l7, unsigned int opt)
+enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct stream *l4, void *l7, unsigned int opt)
 {
 	__label__ fetch_next;
 	struct acl_term_suite *suite;
diff --git a/src/backend.c b/src/backend.c
index 5f20027..ee84571 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -50,7 +50,7 @@
 #include <proto/queue.h>
 #include <proto/sample.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/raw_sock.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
@@ -297,7 +297,7 @@
 /*
  * this does the same as the previous server_ph, but check the body contents
  */
-struct server *get_server_ph_post(struct session *s)
+struct server *get_server_ph_post(struct stream *s)
 {
 	unsigned int hash = 0;
 	struct http_txn *txn  = &s->txn;
@@ -375,7 +375,7 @@
  * is returned. If any server is found, it will be returned. If no valid server
  * is found, NULL is returned.
  */
-struct server *get_server_hh(struct session *s)
+struct server *get_server_hh(struct stream *s)
 {
 	unsigned int hash = 0;
 	struct http_txn *txn  = &s->txn;
@@ -451,7 +451,7 @@
 }
 
 /* RDP Cookie HASH.  */
-struct server *get_server_rch(struct session *s)
+struct server *get_server_rch(struct stream *s)
 {
 	unsigned int hash = 0;
 	struct proxy    *px   = s->be;
@@ -495,31 +495,31 @@
 }
  
 /*
- * This function applies the load-balancing algorithm to the session, as
- * defined by the backend it is assigned to. The session is then marked as
+ * This function applies the load-balancing algorithm to the stream, as
+ * defined by the backend it is assigned to. The stream is then marked as
  * 'assigned'.
  *
- * This function MAY NOT be called with SN_ASSIGNED already set. If the session
+ * This function MAY NOT be called with SN_ASSIGNED already set. If the stream
  * had a server previously assigned, it is rebalanced, trying to avoid the same
  * server, which should still be present in target_srv(&s->target) before the call.
  * The function tries to keep the original connection slot if it reconnects to
  * the same server, otherwise it releases it and tries to offer it.
  *
- * It is illegal to call this function with a session in a queue.
+ * It is illegal to call this function with a stream in a queue.
  *
  * It may return :
  *   SRV_STATUS_OK       if everything is OK. ->srv and ->target are assigned.
- *   SRV_STATUS_NOSRV    if no server is available. Session is not ASSIGNED
- *   SRV_STATUS_FULL     if all servers are saturated. Session is not ASSIGNED
+ *   SRV_STATUS_NOSRV    if no server is available. Stream is not ASSIGNED
+ *   SRV_STATUS_FULL     if all servers are saturated. Stream is not ASSIGNED
  *   SRV_STATUS_INTERNAL for other unrecoverable errors.
  *
- * Upon successful return, the session flag SN_ASSIGNED is set to indicate that
+ * Upon successful return, the stream flag SN_ASSIGNED is set to indicate that
  * it does not need to be called anymore. This means that target_srv(&s->target)
  * can be trusted in balance and direct modes.
  *
  */
 
-int assign_server(struct session *s)
+int assign_server(struct stream *s)
 {
 	struct connection *conn;
 	struct server *conn_slot;
@@ -559,7 +559,7 @@
 	       server_has_room(__objt_server(conn->target)) ||
 	       (__objt_server(conn->target)->nbpend + 1) < s->be->max_ka_queue))) &&
 	    srv_is_usable(__objt_server(conn->target))) {
-		/* This session was relying on a server in a previous request
+		/* This stream was relying on a server in a previous request
 		 * and the proxy has "option prefer-last-server" set, so
 		 * let's try to reuse the same server.
 		 */
@@ -729,7 +729,7 @@
 }
 
 /*
- * This function assigns a server address to a session, and sets SN_ADDR_SET.
+ * This function assigns a server address to a stream, and sets SN_ADDR_SET.
  * The address is taken from the currently assigned server, or from the
  * dispatch or transparent address.
  *
@@ -737,14 +737,14 @@
  *   SRV_STATUS_OK       if everything is OK.
  *   SRV_STATUS_INTERNAL for other unrecoverable errors.
  *
- * Upon successful return, the session flag SN_ADDR_SET is set. This flag is
+ * Upon successful return, the stream flag SN_ADDR_SET is set. This flag is
  * not cleared, so it's to the caller to clear it if required.
  *
  * The caller is responsible for having already assigned a connection
  * to si->end.
  *
  */
-int assign_server_address(struct session *s)
+int assign_server_address(struct stream *s)
 {
 	struct connection *cli_conn = objt_conn(s->si[0].end);
 	struct connection *srv_conn = objt_conn(s->si[1].end);
@@ -754,7 +754,7 @@
 #endif
 
 	if ((s->flags & SN_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) {
-		/* A server is necessarily known for this session */
+		/* A server is necessarily known for this stream */
 		if (!(s->flags & SN_ASSIGNED))
 			return SRV_STATUS_INTERNAL;
 
@@ -817,13 +817,13 @@
 	return SRV_STATUS_OK;
 }
 
-/* This function assigns a server to session <s> if required, and can add the
+/* This function assigns a server to stream <s> if required, and can add the
  * connection to either the assigned server's queue or to the proxy's queue.
- * If ->srv_conn is set, the session is first released from the server.
+ * If ->srv_conn is set, the stream is first released from the server.
  * It may also be called with SN_DIRECT and/or SN_ASSIGNED though. It will
  * be called before any connection and after any retry or redispatch occurs.
  *
- * It is not allowed to call this function with a session in a queue.
+ * It is not allowed to call this function with a stream in a queue.
  *
  * Returns :
  *
@@ -836,7 +836,7 @@
  *   SRV_STATUS_INTERNAL for other unrecoverable errors.
  *
  */
-int assign_server_and_queue(struct session *s)
+int assign_server_and_queue(struct stream *s)
 {
 	struct pendconn *p;
 	struct server *srv;
@@ -851,8 +851,8 @@
 
 		err = assign_server(s);
 		if (prev_srv) {
-			/* This session was previously assigned to a server. We have to
-			 * update the session's and the server's stats :
+			/* This stream was previously assigned to a server. We have to
+			 * update the stream's and the server's stats :
 			 *  - if the server changed :
 			 *    - set TX_CK_DOWN if txn.flags was TX_CK_VALID
 			 *    - set SN_REDISP if it was successfully redispatched
@@ -886,7 +886,7 @@
 		if (s->srv_conn == srv)
 			return SRV_STATUS_OK;
 
-		/* OK, this session already has an assigned server, but no
+		/* OK, this stream already has an assigned server, but no
 		 * connection slot yet. Either it is a redispatch, or it was
 		 * assigned from persistence information (direct mode).
 		 */
@@ -898,7 +898,7 @@
 			return SRV_STATUS_OK;
 		}
 
-		/* We might have to queue this session if the assigned server is full.
+		/* We might have to queue this stream if the assigned server is full.
 		 * We know we have to queue it into the server's queue, so if a maxqueue
 		 * is set on the server, we must also check that the server's queue is
 		 * not full, in which case we have to return FULL.
@@ -921,7 +921,7 @@
 		return SRV_STATUS_OK;
 
 	case SRV_STATUS_FULL:
-		/* queue this session into the proxy's queue */
+		/* queue this stream into the proxy's queue */
 		p = pendconn_add(s);
 		if (p)
 			return SRV_STATUS_QUEUED;
@@ -941,10 +941,10 @@
 
 /* If an explicit source binding is specified on the server and/or backend, and
  * this source makes use of the transparent proxy, then it is extracted now and
- * assigned to the session's pending connection. This function assumes that an
+ * assigned to the stream's pending connection. This function assumes that an
  * outgoing connection has already been assigned to s->si[1].end.
  */
-static void assign_tproxy_address(struct session *s)
+static void assign_tproxy_address(struct stream *s)
 {
 #if defined(CONFIG_HAP_CTTPROXY) || defined(CONFIG_HAP_TRANSPARENT)
 	struct server *srv = objt_server(s->target);
@@ -1000,7 +1000,7 @@
 
 
 /*
- * This function initiates a connection to the server assigned to this session
+ * This function initiates a connection to the server assigned to this stream
  * (s->target, s->si[1].addr.to). It will assign a server if none
  * is assigned yet.
  * It can return one of :
@@ -1014,7 +1014,7 @@
  * The server-facing stream interface is expected to hold a pre-allocated connection
  * in s->si[1].conn.
  */
-int connect_server(struct session *s)
+int connect_server(struct stream *s)
 {
 	struct connection *cli_conn;
 	struct connection *srv_conn;
@@ -1054,7 +1054,7 @@
 	}
 
 	if (!conn_xprt_ready(srv_conn)) {
-		/* the target was only on the session, assign it to the SI now */
+		/* the target was only on the stream, assign it to the SI now */
 		srv_conn->target = s->target;
 
 		/* set the correct protocol on the output stream interface */
@@ -1127,7 +1127,7 @@
  * that the connection is ready to use.
  */
 
-int srv_redispatch_connect(struct session *s)
+int srv_redispatch_connect(struct stream *s)
 {
 	struct server *srv;
 	int conn_err;
@@ -1177,7 +1177,7 @@
 	case SRV_STATUS_QUEUED:
 		s->si[1].exp = tick_add_ifset(now_ms, s->be->timeout.queue);
 		s->si[1].state = SI_ST_QUE;
-		/* do nothing else and do not wake any other session up */
+		/* do nothing else and do not wake any other stream up */
 		return 1;
 
 	case SRV_STATUS_INTERNAL:
@@ -1194,7 +1194,7 @@
 			srv->counters.failed_conns++;
 		s->be->be_counters.failed_conns++;
 
-		/* release other sessions waiting for this server */
+		/* release other streams waiting for this server */
 		if (may_dequeue_tasks(srv, s->be))
 			process_srv_queue(srv);
 		return 1;
@@ -1217,13 +1217,13 @@
 	send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id);
 }
 
-/* Apply RDP cookie persistence to the current session. For this, the function
+/* Apply RDP cookie persistence to the current stream. For this, the function
  * tries to extract an RDP cookie from the request buffer, and look for the
  * matching server in the list. If the server is found, it is assigned to the
- * session. This always returns 1, and the analyser removes itself from the
+ * stream. This always returns 1, and the analyser removes itself from the
  * list. Nothing is performed if a server was already assigned.
  */
-int tcp_persist_rdp_cookie(struct session *s, struct channel *req, int an_bit)
+int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit)
 {
 	struct proxy    *px   = s->be;
 	int              ret;
@@ -1232,7 +1232,7 @@
 	struct sockaddr_in addr;
 	char *p;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -1483,7 +1483,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_nbsrv(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -1506,7 +1506,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_srv_is_up(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct server *srv = args->data.srv;
@@ -1526,7 +1526,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_connslots(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_connslots(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct server *iterator;
@@ -1554,7 +1554,7 @@
 
 /* set temp integer to the id of the backend */
 static int
-smp_fetch_be_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_be_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TXN;
@@ -1565,7 +1565,7 @@
 
 /* set temp integer to the id of the server */
 static int
-smp_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_srv_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	if (!objt_server(l4->target))
@@ -1582,7 +1582,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_be_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -1596,7 +1596,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_be_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -1610,7 +1610,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_queue_size(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -1628,7 +1628,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_avg_queue_size(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                          const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int nbsrv;
@@ -1657,7 +1657,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_srv_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                    const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -1671,7 +1671,7 @@
  * undefined behaviour.
  */
 static int
-smp_fetch_srv_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_srv_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
diff --git a/src/cfgparse.c b/src/cfgparse.c
index b17527d..92f072e 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -74,7 +74,7 @@
 #include <proto/peers.h>
 #include <proto/sample.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/raw_sock.h>
 #include <proto/task.h>
 #include <proto/stick_table.h>
@@ -1884,8 +1884,8 @@
 					l->maxaccept = 1;
 					l->maxconn = ((struct proxy *)curpeers->peers_fe)->maxconn;
 					l->backlog = ((struct proxy *)curpeers->peers_fe)->backlog;
-					l->accept = session_accept;
-					l->handler = process_session;
+					l->accept = stream_accept;
+					l->handler = process_stream;
 					l->analysers |=  ((struct proxy *)curpeers->peers_fe)->fe_req_ana;
 					l->default_target = ((struct proxy *)curpeers->peers_fe)->default_target;
 					l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
@@ -4112,7 +4112,7 @@
 			curproxy->conf.lfs_line = curproxy->conf.args.line;
 		}
 		else if (!strcmp(args[1], "tcpka")) {
-			/* enable TCP keep-alives on client and server sessions */
+			/* enable TCP keep-alives on client and server streams */
 			if (warnifnotcap(curproxy, PR_CAP_BE | PR_CAP_FE, file, linenum, args[1], NULL))
 				err_code |= ERR_WARN;
 
@@ -7708,8 +7708,8 @@
 				listener->maxaccept = (listener->maxaccept + nbproc - 1) / nbproc;
 			}
 
-			listener->accept = session_accept;
-			listener->handler = process_session;
+			listener->accept = stream_accept;
+			listener->handler = process_stream;
 			listener->analysers |= curproxy->fe_req_ana;
 			listener->default_target = curproxy->default_target;
 
diff --git a/src/checks.c b/src/checks.c
index 89e5eee..b3a005b 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -57,7 +57,6 @@
 #include <proto/proxy.h>
 #include <proto/raw_sock.h>
 #include <proto/server.h>
-#include <proto/session.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 
diff --git a/src/compression.c b/src/compression.c
index 9900d71..feade6b 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -157,7 +157,7 @@
 /*
  * Init HTTP compression
  */
-int http_compression_buffer_init(struct session *s, struct buffer *in, struct buffer *out)
+int http_compression_buffer_init(struct stream *s, struct buffer *in, struct buffer *out)
 {
 	/* output stream requires at least 10 bytes for the gzip header, plus
 	 * at least 8 bytes for the gzip trailer (crc+len), plus a possible
@@ -181,7 +181,7 @@
 /*
  * Add data to compress
  */
-int http_compression_buffer_add_data(struct session *s, struct buffer *in, struct buffer *out)
+int http_compression_buffer_add_data(struct stream *s, struct buffer *in, struct buffer *out)
 {
 	struct http_msg *msg = &s->txn.rsp;
 	int consumed_data = 0;
@@ -229,7 +229,7 @@
  * Flush data in process, and write the header and footer of the chunk. Upon
  * success, in and out buffers are swapped to avoid a copy.
  */
-int http_compression_buffer_end(struct session *s, struct buffer **in, struct buffer **out, int end)
+int http_compression_buffer_end(struct stream *s, struct buffer **in, struct buffer **out, int end)
 {
 	int to_forward;
 	int left;
@@ -837,7 +837,7 @@
 
 /* boolean, returns true if compression is used (either gzip or deflate) in the response */
 static int
-smp_fetch_res_comp(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_res_comp(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_BOOL;
@@ -847,7 +847,7 @@
 
 /* string, returns algo */
 static int
-smp_fetch_res_comp_algo(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_res_comp_algo(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	if (!l4->comp_algo)
diff --git a/src/connection.c b/src/connection.c
index efcd6e1..21fd8fe 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -20,7 +20,6 @@
 #include <proto/fd.h>
 #include <proto/frontend.h>
 #include <proto/proto_tcp.h>
-#include <proto/session.h>
 #include <proto/stream_interface.h>
 
 #ifdef USE_OPENSSL
diff --git a/src/dumpstats.c b/src/dumpstats.c
index c23e988..5f663b6 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -56,7 +56,7 @@
 #include <proto/proto_uxst.h>
 #include <proto/proxy.h>
 #include <proto/sample.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/server.h>
 #include <proto/raw_sock.h>
 #include <proto/stream_interface.h>
@@ -76,7 +76,7 @@
 	STAT_CLI_PRINT,      /* display message in cli->msg */
 	STAT_CLI_PRINT_FREE, /* display message in cli->msg. After the display, free the pointer */
 	STAT_CLI_O_INFO,     /* dump info */
-	STAT_CLI_O_SESS,     /* dump sessions */
+	STAT_CLI_O_SESS,     /* dump streams */
 	STAT_CLI_O_ERR,      /* dump errors */
 	STAT_CLI_O_TAB,      /* dump tables */
 	STAT_CLI_O_CLR,      /* clear tables */
@@ -123,7 +123,7 @@
 
 static int stats_dump_info_to_buffer(struct stream_interface *si);
 static int stats_dump_pools_to_buffer(struct stream_interface *si);
-static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct session *sess);
+static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct stream *sess);
 static int stats_dump_sess_to_buffer(struct stream_interface *si);
 static int stats_dump_errors_to_buffer(struct stream_interface *si);
 static int stats_table_request(struct stream_interface *si, int show);
@@ -337,8 +337,8 @@
 		list_for_each_entry(l, &bind_conf->listeners, by_bind) {
 			l->maxconn = global.stats_fe->maxconn;
 			l->backlog = global.stats_fe->backlog;
-			l->accept = session_accept;
-			l->handler = process_session;
+			l->accept = stream_accept;
+			l->handler = process_stream;
 			l->default_target = global.stats_fe->default_target;
 			l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
 			l->nice = -64;  /* we want to boost priority for local stats */
@@ -544,7 +544,7 @@
 static int stats_dump_table_head_to_buffer(struct chunk *msg, struct stream_interface *si,
 					   struct proxy *proxy, struct proxy *target)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 
 	chunk_appendf(msg, "# table: %s, type: %s, size:%d, used:%d\n",
 		     proxy->id, stktable_types[proxy->table.type].kw, proxy->table.size, proxy->table.current);
@@ -637,7 +637,7 @@
 
 static void stats_sock_table_key_request(struct stream_interface *si, char **args, int action)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct appctx *appctx = __objt_appctx(si->end);
 	struct proxy *px = appctx->ctx.table.target;
 	struct stksess *ts;
@@ -897,10 +897,10 @@
 }
 
 /* Expects to find a frontend named <arg> and returns it, otherwise displays various
- * adequate error messages and returns NULL. This function also expects the session
+ * adequate error messages and returns NULL. This function also expects the stream
  * level to be admin.
  */
-static struct proxy *expect_frontend_admin(struct session *s, struct stream_interface *si, const char *arg)
+static struct proxy *expect_frontend_admin(struct stream *s, struct stream_interface *si, const char *arg)
 {
 	struct appctx *appctx = __objt_appctx(si->end);
 	struct proxy *px;
@@ -928,10 +928,10 @@
 
 /* Expects to find a backend and a server in <arg> under the form <backend>/<server>,
  * and returns the pointer to the server. Otherwise, display adequate error messages
- * and returns NULL. This function also expects the session level to be admin. Note:
+ * and returns NULL. This function also expects the stream level to be admin. Note:
  * the <arg> is modified to remove the '/'.
  */
-static struct server *expect_server_admin(struct session *s, struct stream_interface *si, char *arg)
+static struct server *expect_server_admin(struct stream *s, struct stream_interface *si, char *arg)
 {
 	struct appctx *appctx = __objt_appctx(si->end);
 	struct proxy *px;
@@ -1040,7 +1040,7 @@
  */
 static int stats_sock_parse_request(struct stream_interface *si, char *line)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct appctx *appctx = __objt_appctx(si->end);
 	char *args[MAX_STATS_ARGS + 1];
 	int arg;
@@ -1122,7 +1122,7 @@
 				appctx->ctx.sess.target = (void *)strtoul(args[2], NULL, 0);
 			else
 				appctx->ctx.sess.target = NULL;
-			appctx->ctx.sess.section = 0; /* start with session status */
+			appctx->ctx.sess.section = 0; /* start with stream status */
 			appctx->ctx.sess.pos = 0;
 			appctx->st0 = STAT_CLI_O_SESS; // stats_dump_sess_to_buffer
 		}
@@ -1979,7 +1979,7 @@
 			return 1;
 		}
 		else if (strcmp(args[1], "session") == 0) {
-			struct session *sess, *ptr;
+			struct stream *sess, *ptr;
 
 			if (s->listener->bind_conf->level < ACCESS_LVL_ADMIN) {
 				appctx->ctx.cli.msg = stats_permission_denied_msg;
@@ -1995,35 +1995,35 @@
 
 			ptr = (void *)strtoul(args[2], NULL, 0);
 
-			/* first, look for the requested session in the session table */
-			list_for_each_entry(sess, &sessions, list) {
+			/* first, look for the requested stream in the stream table */
+			list_for_each_entry(sess, &streams, list) {
 				if (sess == ptr)
 					break;
 			}
 
-			/* do we have the session ? */
+			/* do we have the stream ? */
 			if (sess != ptr) {
 				appctx->ctx.cli.msg = "No such session (use 'show sess').\n";
 				appctx->st0 = STAT_CLI_PRINT;
 				return 1;
 			}
 
-			session_shutdown(sess, SN_ERR_KILLED);
+			stream_shutdown(sess, SN_ERR_KILLED);
 			return 1;
 		}
 		else if (strcmp(args[1], "sessions") == 0) {
 			if (strcmp(args[2], "server") == 0) {
 				struct server *sv;
-				struct session *sess, *sess_bck;
+				struct stream *sess, *sess_bck;
 
 				sv = expect_server_admin(s, si, args[3]);
 				if (!sv)
 					return 1;
 
-				/* kill all the session that are on this server */
+				/* kill all the stream that are on this server */
 				list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
 					if (sess->srv_conn == sv)
-						session_shutdown(sess, SN_ERR_KILLED);
+						stream_shutdown(sess, SN_ERR_KILLED);
 
 				return 1;
 			}
@@ -3727,7 +3727,7 @@
 static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, struct uri_auth *uri)
 {
 	struct appctx *appctx = __objt_appctx(si->end);
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct channel *rep = si_ic(si);
 	struct server *sv, *svs;	/* server and server-state, server-state=server or server->track */
 	struct listener *l;
@@ -4306,7 +4306,7 @@
  * either CSV or HTML format. <uri> contains some HTML-specific parameters that
  * are ignored for CSV format (hence <uri> may be NULL there). It returns 0 if
  * it had to stop writing data and an I/O is needed, 1 if the dump is finished
- * and the session must be closed, or -1 in case of any error. This function is
+ * and the stream must be closed, or -1 in case of any error. This function is
  * used by both the CLI and the HTTP handlers.
  */
 static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_auth *uri)
@@ -4401,7 +4401,7 @@
  */
 static int stats_process_http_post(struct stream_interface *si)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct appctx *appctx = objt_appctx(si->end);
 
 	struct proxy *px = NULL;
@@ -4670,11 +4670,11 @@
 						break;
 					case ST_ADM_ACTION_SHUTDOWN:
 						if (px->state != PR_STSTOPPED) {
-							struct session *sess, *sess_bck;
+							struct stream *sess, *sess_bck;
 
 							list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
 								if (sess->srv_conn == sv)
-									session_shutdown(sess, SN_ERR_KILLED);
+									stream_shutdown(sess, SN_ERR_KILLED);
 
 							altered_servers++;
 							total_servers++;
@@ -4720,7 +4720,7 @@
 
 static int stats_send_http_headers(struct stream_interface *si)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct uri_auth *uri = s->be->uri_auth;
 	struct appctx *appctx = objt_appctx(si->end);
 
@@ -4756,7 +4756,7 @@
 static int stats_send_http_redirect(struct stream_interface *si)
 {
 	char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct uri_auth *uri = s->be->uri_auth;
 	struct appctx *appctx = objt_appctx(si->end);
 
@@ -4808,7 +4808,7 @@
 static void http_stats_io_handler(struct stream_interface *si)
 {
 	struct appctx *appctx = __objt_appctx(si->end);
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct channel *req = si_oc(si);
 	struct channel *res = si_ic(si);
 
@@ -4978,12 +4978,12 @@
 	return ptr;
 }
 
-/* This function dumps a complete session state onto the stream interface's
- * read buffer. The session has to be set in sess->target. It returns
+/* This function dumps a complete stream state onto the stream interface's
+ * read buffer. The stream has to be set in sess->target. It returns
  * 0 if the output buffer is full and it needs to be called again, otherwise
  * non-zero. It is designed to be called from stats_dump_sess_to_buffer() below.
  */
-static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct session *sess)
+static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct stream *sess)
 {
 	struct appctx *appctx = __objt_appctx(si->end);
 	struct tm tm;
@@ -4995,7 +4995,7 @@
 	chunk_reset(&trash);
 
 	if (appctx->ctx.sess.section > 0 && appctx->ctx.sess.uid != sess->uniq_id) {
-		/* session changed, no need to go any further */
+		/* stream changed, no need to go any further */
 		chunk_appendf(&trash, "  *** session terminated while we were watching it ***\n");
 		if (bi_putchk(si_ic(si), &trash) == -1) {
 			si->flags |= SI_FL_WAIT_ROOM;
@@ -5007,7 +5007,7 @@
 	}
 
 	switch (appctx->ctx.sess.section) {
-	case 0: /* main status of the session */
+	case 0: /* main status of the stream */
 		appctx->ctx.sess.uid = sess->uniq_id;
 		appctx->ctx.sess.section = 1;
 		/* fall through */
@@ -5332,8 +5332,8 @@
 			              appctx->ctx.map.ref->display);
 
 			if (bi_putchk(si_ic(si), &trash) == -1) {
-				/* let's try again later from this session. We add ourselves into
-				 * this session's users so that it can remove us upon termination.
+				/* let's try again later from this stream. We add ourselves into
+				 * this stream's users so that it can remove us upon termination.
 				 */
 				si->flags |= SI_FL_WAIT_ROOM;
 				return 0;
@@ -5451,8 +5451,8 @@
 
 			/* display response */
 			if (bi_putchk(si_ic(si), &trash) == -1) {
-				/* let's try again later from this session. We add ourselves into
-				 * this session's users so that it can remove us upon termination.
+				/* let's try again later from this stream. We add ourselves into
+				 * this stream's users so that it can remove us upon termination.
 				 */
 				si->flags |= SI_FL_WAIT_ROOM;
 				return 0;
@@ -5502,8 +5502,8 @@
 				              appctx->ctx.map.elt, appctx->ctx.map.elt->pattern);
 
 			if (bi_putchk(si_ic(si), &trash) == -1) {
-				/* let's try again later from this session. We add ourselves into
-				 * this session's users so that it can remove us upon termination.
+				/* let's try again later from this stream. We add ourselves into
+				 * this stream's users so that it can remove us upon termination.
 				 */
 				si->flags |= SI_FL_WAIT_ROOM;
 				return 0;
@@ -5525,7 +5525,7 @@
 	}
 }
 
-/* This function dumps all sessions' states onto the stream interface's
+/* This function dumps all streams' states onto the stream interface's
  * read buffer. It returns 0 if the output buffer is full and it needs
  * to be called again, otherwise non-zero. It is designed to be called
  * from stats_dump_sess_to_buffer() below.
@@ -5537,7 +5537,7 @@
 
 	if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
 		/* If we're forced to shut down, we might have to remove our
-		 * reference to the last session being dumped.
+		 * reference to the last stream being dumped.
 		 */
 		if (appctx->st2 == STAT_ST_LIST) {
 			if (!LIST_ISEMPTY(&appctx->ctx.sess.bref.users)) {
@@ -5553,30 +5553,30 @@
 	switch (appctx->st2) {
 	case STAT_ST_INIT:
 		/* the function had not been called yet, let's prepare the
-		 * buffer for a response. We initialize the current session
+		 * buffer for a response. We initialize the current stream
 		 * pointer to the first in the global list. When a target
-		 * session is being destroyed, it is responsible for updating
+		 * stream is being destroyed, it is responsible for updating
 		 * this pointer. We know we have reached the end when this
-		 * pointer points back to the head of the sessions list.
+		 * pointer points back to the head of the streams list.
 		 */
 		LIST_INIT(&appctx->ctx.sess.bref.users);
-		appctx->ctx.sess.bref.ref = sessions.n;
+		appctx->ctx.sess.bref.ref = streams.n;
 		appctx->st2 = STAT_ST_LIST;
 		/* fall through */
 
 	case STAT_ST_LIST:
-		/* first, let's detach the back-ref from a possible previous session */
+		/* first, let's detach the back-ref from a possible previous stream */
 		if (!LIST_ISEMPTY(&appctx->ctx.sess.bref.users)) {
 			LIST_DEL(&appctx->ctx.sess.bref.users);
 			LIST_INIT(&appctx->ctx.sess.bref.users);
 		}
 
 		/* and start from where we stopped */
-		while (appctx->ctx.sess.bref.ref != &sessions) {
+		while (appctx->ctx.sess.bref.ref != &streams) {
 			char pn[INET6_ADDRSTRLEN];
-			struct session *curr_sess;
+			struct stream *curr_sess;
 
-			curr_sess = LIST_ELEM(appctx->ctx.sess.bref.ref, struct session *, list);
+			curr_sess = LIST_ELEM(appctx->ctx.sess.bref.ref, struct stream *, list);
 
 			if (appctx->ctx.sess.target) {
 				if (appctx->ctx.sess.target != (void *)-1 && appctx->ctx.sess.target != curr_sess)
@@ -5587,7 +5587,7 @@
 				if (!stats_dump_full_sess_to_buffer(si, curr_sess))
 					return 0;
 
-				/* session dump complete */
+				/* stream dump complete */
 				LIST_DEL(&appctx->ctx.sess.bref.users);
 				LIST_INIT(&appctx->ctx.sess.bref.users);
 				if (appctx->ctx.sess.target != (void *)-1) {
@@ -5707,8 +5707,8 @@
 			chunk_appendf(&trash, "\n");
 
 			if (bi_putchk(si_ic(si), &trash) == -1) {
-				/* let's try again later from this session. We add ourselves into
-				 * this session's users so that it can remove us upon termination.
+				/* let's try again later from this stream. We add ourselves into
+				 * this stream's users so that it can remove us upon termination.
 				 */
 				si->flags |= SI_FL_WAIT_ROOM;
 				LIST_ADDQ(&curr_sess->back_refs, &appctx->ctx.sess.bref.users);
@@ -5720,7 +5720,7 @@
 		}
 
 		if (appctx->ctx.sess.target && appctx->ctx.sess.target != (void *)-1) {
-			/* specified session not found */
+			/* specified stream not found */
 			if (appctx->ctx.sess.section > 0)
 				chunk_appendf(&trash, "  *** session terminated while we were watching it ***\n");
 			else
@@ -5747,7 +5747,7 @@
 
 /* This is called when the stream interface is closed. For instance, upon an
  * external abort, we won't call the i/o handler anymore so we may need to
- * remove back references to the session currently being dumped.
+ * remove back references to the stream currently being dumped.
  */
 static void cli_release_handler(struct stream_interface *si)
 {
@@ -5773,7 +5773,7 @@
 static int stats_table_request(struct stream_interface *si, int action)
 {
 	struct appctx *appctx = __objt_appctx(si->end);
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct ebmb_node *eb;
 	int dt;
 	int skip_entry;
diff --git a/src/frontend.c b/src/frontend.c
index 48dabe8..b793ff8 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -42,17 +42,17 @@
 #include <proto/proto_http.h>
 #include <proto/proxy.h>
 #include <proto/sample.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 
-/* Finish a session accept() for a proxy (TCP or HTTP). It returns a negative
+/* Finish a stream accept() for a proxy (TCP or HTTP). It returns a negative
  * value in case of a critical failure which must cause the listener to be
  * disabled, a positive value in case of success, or zero if it is a success
- * but the session must be closed ASAP (eg: monitoring). It only supports
- * sessions with a connection in si[0].
+ * but the stream must be closed ASAP (eg: monitoring). It only supports
+ * streams with a connection in si[0].
  */
-int frontend_accept(struct session *s)
+int frontend_accept(struct stream *s)
 {
 	struct connection *conn = __objt_conn(s->si[0].end);
 	int cfd = conn->t.sock.fd;
@@ -69,7 +69,7 @@
 	/* FIXME: the logs are horribly complicated now, because they are
 	 * defined in <p>, <p>, and later <be> and <be>.
 	 */
-	s->do_log = sess_log;
+	s->do_log = strm_log;
 
 	/* default error reporting function, may be changed by analysers */
 	s->srv_error = default_srv_error;
@@ -218,7 +218,7 @@
 
 /* set temp integer to the id of the frontend */
 static int
-smp_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_fe_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_SESS;
@@ -232,7 +232,7 @@
  * an undefined behaviour.
  */
 static int
-smp_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_fe_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -246,7 +246,7 @@
  * an undefined behaviour.
  */
 static int
-smp_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_fe_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
diff --git a/src/haproxy.c b/src/haproxy.c
index 8063f37..11b7810 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -97,7 +97,7 @@
 #include <proto/proxy.h>
 #include <proto/queue.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/signal.h>
 #include <proto/task.h>
 
@@ -559,7 +559,7 @@
 	if (init_acl() != 0)
 		exit(1);
 	init_task();
-	init_session();
+	init_stream();
 	init_connection();
 	/* warning, we init buffers later */
 	init_pendconn();
@@ -840,7 +840,7 @@
 		mem = mem * MEM_USABLE_RATIO;
 
 		global.maxconn = mem /
-			((SESSION_MAX_COST + 2 * global.tune.bufsize) +    // session + 2 buffers per session
+			((STREAM_MAX_COST + 2 * global.tune.bufsize) +    // stream + 2 buffers per stream
 			 sides * global.ssl_session_max_cost + // SSL buffers, one per side
 			 global.ssl_handshake_max_cost);       // 1 handshake per connection max
 
@@ -870,7 +870,7 @@
 		mem -= global.maxzlibmem;
 		mem = mem * MEM_USABLE_RATIO;
 
-		sslmem = mem - global.maxconn * (int64_t)(SESSION_MAX_COST + 2 * global.tune.bufsize);
+		sslmem = mem - global.maxconn * (int64_t)(STREAM_MAX_COST + 2 * global.tune.bufsize);
 		global.maxsslconn = sslmem / (global.ssl_session_max_cost + global.ssl_handshake_max_cost);
 		global.maxsslconn = round_2dig(global.maxsslconn);
 
@@ -879,7 +879,7 @@
 			      "high for the global.memmax value (%d MB). The absolute maximum possible value "
 			      "without SSL is %d, but %d was found and SSL is in use.\n",
 			      global.rlimit_memmax,
-			      (int)(mem / (SESSION_MAX_COST + 2 * global.tune.bufsize)),
+			      (int)(mem / (STREAM_MAX_COST + 2 * global.tune.bufsize)),
 			      global.maxconn);
 			exit(1);
 		}
@@ -907,7 +907,7 @@
 		if (sides)
 			clearmem -= (global.ssl_session_max_cost + global.ssl_handshake_max_cost) * (int64_t)global.maxsslconn;
 
-		global.maxconn = clearmem / (SESSION_MAX_COST + 2 * global.tune.bufsize);
+		global.maxconn = clearmem / (STREAM_MAX_COST + 2 * global.tune.bufsize);
 		global.maxconn = round_2dig(global.maxconn);
 #ifdef SYSTEM_MAXCONN
 		if (global.maxconn > DEFAULT_MAXCONN)
@@ -1430,7 +1430,7 @@
 		free(wl);
 	}
 
-	pool_destroy2(pool2_session);
+	pool_destroy2(pool2_stream);
 	pool_destroy2(pool2_connection);
 	pool_destroy2(pool2_buffer);
 	pool_destroy2(pool2_requri);
diff --git a/src/hlua.c b/src/hlua.c
index c8a0cc5..4b04f87 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -31,7 +31,7 @@
 #include <proto/raw_sock.h>
 #include <proto/sample.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/ssl_sock.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
@@ -77,7 +77,7 @@
 static int class_http_ref;
 
 /* Global Lua execution timeout. By default Lua, execution linked
- * with session (actions, sample-fetches and converters) have a
+ * with stream (actions, sample-fetches and converters) have a
  * short timeout. Lua linked with tasks doesn't have a timeout
  * because a task may remain alive during all the haproxy execution.
  */
@@ -792,8 +792,8 @@
 	WILL_LJMP(lua_yieldk(L, nresults, ctx, k));
 }
 
-/* This function initialises the Lua environment stored in the session.
- * It must be called at the start of the session. This function creates
+/* This function initialises the Lua environment stored in the stream.
+ * It must be called at the start of the stream. This function creates
  * an LUA coroutine. It can not be use to crete the main LUA context.
  */
 int hlua_ctx_init(struct hlua *lua, struct task *task)
@@ -812,7 +812,7 @@
 	return 1;
 }
 
-/* Used to destroy the Lua coroutine when the attached session or task
+/* Used to destroy the Lua coroutine when the attached stream or task
  * is destroyed. The destroy also the memory context. The struct "lua"
  * is not freed.
  */
@@ -1286,7 +1286,7 @@
 	struct appctx *appctx = objt_appctx(si->end);
 	struct connection *c = objt_conn(si_opposite(si)->end);
 
-	/* Wakeup the main session if the client connection is closed. */
+	/* Wakeup the main stream if the client connection is closed. */
 	if (!c || channel_output_closed(si_ic(si)) || channel_input_closed(si_oc(si))) {
 		if (appctx->ctx.hlua.socket) {
 			appctx->ctx.hlua.socket->s = NULL;
@@ -1315,8 +1315,8 @@
 		hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
 }
 
-/* This function is called when the "struct session" is destroyed.
- * Remove the link from the object to this session.
+/* This function is called when the "struct stream" is destroyed.
+ * Remove the link from the object to this stream.
  * Wake all the pending signals.
  */
 static void hlua_socket_release(struct stream_interface *si)
@@ -1333,8 +1333,8 @@
 }
 
 /* If the garbage collectio of the object is launch, nobody
- * uses this object. If the session does not exists, just quit.
- * Send the shutdown signal to the session. In some cases,
+ * uses this object. If the stream does not exists, just quit.
+ * Send the shutdown signal to the stream. In some cases,
  * pending signal can rest in the read and write lists. destroy
  * it.
  */
@@ -1349,9 +1349,9 @@
 	if (!socket->s)
 		return 0;
 
-	/* Remove all reference between the Lua stack and the coroutine session. */
+	/* Remove all reference between the Lua stack and the coroutine stream. */
 	appctx = objt_appctx(socket->s->si[0].end);
-	session_shutdown(socket->s, SN_ERR_KILLED);
+	stream_shutdown(socket->s, SN_ERR_KILLED);
 	socket->s = NULL;
 	appctx->ctx.hlua.socket = NULL;
 
@@ -1359,7 +1359,7 @@
 }
 
 /* The close function send shutdown signal and break the
- * links between the session and the object.
+ * links between the stream and the object.
  */
 __LJMP static int hlua_socket_close(lua_State *L)
 {
@@ -1372,8 +1372,8 @@
 	if (!socket->s)
 		return 0;
 
-	/* Close the session and remove the associated stop task. */
-	session_shutdown(socket->s, SN_ERR_KILLED);
+	/* Close the stream and remove the associated stop task. */
+	stream_shutdown(socket->s, SN_ERR_KILLED);
 	appctx = objt_appctx(socket->s->si[0].end);
 	appctx->ctx.hlua.socket = NULL;
 	socket->s = NULL;
@@ -1629,7 +1629,7 @@
 	 * the request buffer if its not required.
 	 */
 	if (socket->s->req.buf->size == 0) {
-		if (!session_alloc_recv_buffer(&socket->s->req)) {
+		if (!stream_alloc_recv_buffer(&socket->s->req)) {
 			socket->s->si[0].flags |= SI_FL_WAIT_ROOM;
 			goto hlua_socket_write_yield_return;
 		}
@@ -2011,12 +2011,12 @@
 	memset(socket, 0, sizeof(*socket));
 
 	/* Check if the various memory pools are intialized. */
-	if (!pool2_session || !pool2_buffer) {
+	if (!pool2_stream || !pool2_buffer) {
 		hlua_pusherror(L, "socket: uninitialized pools.");
 		goto out_fail_conf;
 	}
 
-	/* Pop a class session metatable and affect it to the userdata. */
+	/* Pop a class stream metatable and affect it to the userdata. */
 	lua_rawgeti(L, LUA_REGISTRYINDEX, class_socket_ref);
 	lua_setmetatable(L, -2);
 
@@ -2026,7 +2026,7 @@
 	 *
 	 */
 
-	socket->s = pool_alloc2(pool2_session);
+	socket->s = pool_alloc2(pool2_stream);
 	if (!socket->s) {
 		hlua_pusherror(L, "socket: out of memory");
 		goto out_fail_conf;
@@ -2050,7 +2050,7 @@
 		goto out_fail_rep_buf;
 	}
 
-	/* Configura empty Lua for the session. */
+	/* Configura empty Lua for the stream. */
 	socket->s->hlua.T = NULL;
 	socket->s->hlua.Tref = LUA_REFNIL;
 	socket->s->hlua.Mref = LUA_REFNIL;
@@ -2058,8 +2058,8 @@
 	socket->s->hlua.flags = 0;
 	LIST_INIT(&socket->s->hlua.com);
 
-	/* session initialisation. */
-	session_init_srv_conn(socket->s);
+	/* stream initialisation. */
+	stream_init_srv_conn(socket->s);
 
 	/*
 	 *
@@ -2067,12 +2067,12 @@
 	 *
 	 */
 
-	/* This is the dedicated function to process the session. This function
+	/* This is the dedicated function to process the stream. This function
 	 * is able to establish the conection, process the timeouts, etc ...
 	 */
-	socket->s->task->process = process_session;
+	socket->s->task->process = process_stream;
 
-	/* Back reference to session. This is used by process_session(). */
+	/* Back reference to stream. This is used by process_stream(). */
 	socket->s->task->context = socket->s;
 
 	/* The priority of the task is normal. */
@@ -2120,11 +2120,11 @@
 
 	/*
 	 *
-	 * Configure the session.
+	 * Configure the stream.
 	 *
 	 */
 
-	/* The session dont have listener. The listener is used with real
+	/* The stream dont have listener. The listener is used with real
 	 * proxies.
 	 */
 	socket->s->listener = NULL;
@@ -2132,7 +2132,7 @@
 	/* The flags are initialized to 0. Values are setted later. */
 	socket->s->flags = 0;
 
-	/* Assign the configured proxy to the new session. */
+	/* Assign the configured proxy to the new stream. */
 	socket->s->be = &socket_proxy;
 	socket->s->fe = &socket_proxy;
 
@@ -2207,8 +2207,8 @@
 	socket->s->flags |= SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET | SN_BE_ASSIGNED;
 	socket->s->target = &socket_tcp.obj_type;
 
-	/* This session is added to te lists of alive sessions. */
-	LIST_ADDQ(&sessions, &socket->s->list);
+	/* This stream is added to te lists of alive streams. */
+	LIST_ADDQ(&streams, &socket->s->list);
 
 	/* XXX: I think that this list is used by stats. */
 	LIST_INIT(&socket->s->back_refs);
@@ -2228,7 +2228,7 @@
 out_fail_req_buf:
 	task_free(socket->s->task);
 out_free_session:
-	pool_free2(pool2_session, socket->s);
+	pool_free2(pool2_stream, socket->s);
 out_fail_conf:
 	WILL_LJMP(lua_error(L));
 	return 0;
@@ -2509,7 +2509,7 @@
 	 * the request buffer if its not required.
 	 */
 	if (chn->buf->size == 0) {
-		if (!session_alloc_recv_buffer(chn)) {
+		if (!stream_alloc_recv_buffer(chn)) {
 			chn_prod(chn)->flags |= SI_FL_WAIT_ROOM;
 			WILL_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_send_yield, TICK_ETERNITY, 0));
 		}
@@ -2686,7 +2686,7 @@
  */
 
 /* Returns a struct hlua_session if the stack entry "ud" is
- * a class session, otherwise it throws an error.
+ * a class stream, otherwise it throws an error.
  */
 __LJMP static struct hlua_smp *hlua_checkfetches(lua_State *L, int ud)
 {
@@ -2790,7 +2790,7 @@
  */
 
 /* Returns a struct hlua_session if the stack entry "ud" is
- * a class session, otherwise it throws an error.
+ * a class stream, otherwise it throws an error.
  */
 __LJMP static struct hlua_smp *hlua_checkconverters(lua_State *L, int ud)
 {
@@ -2821,7 +2821,7 @@
 	hsmp->l7 = txn->l7;
 	hsmp->stringsafe = stringsafe;
 
-	/* Pop a class session metatable and affect it to the table. */
+	/* Pop a class stream metatable and affect it to the table. */
 	lua_rawgeti(L, LUA_REGISTRYINDEX, class_converters_ref);
 	lua_setmetatable(L, -2);
 
@@ -2909,7 +2909,7 @@
  */
 
 /* Returns a struct hlua_txn if the stack entry "ud" is
- * a class session, otherwise it throws an error.
+ * a class stream, otherwise it throws an error.
  */
 __LJMP static struct hlua_txn *hlua_checkhttp(lua_State *L, int ud)
 {
@@ -2939,7 +2939,7 @@
 	htxn->p = txn->p;
 	htxn->l7 = txn->l7;
 
-	/* Pop a class session metatable and affect it to the table. */
+	/* Pop a class stream metatable and affect it to the table. */
 	lua_rawgeti(L, LUA_REGISTRYINDEX, class_http_ref);
 	lua_setmetatable(L, -2);
 
@@ -3264,7 +3264,7 @@
  */
 
 /* Returns a struct hlua_session if the stack entry "ud" is
- * a class session, otherwise it throws an error.
+ * a class stream, otherwise it throws an error.
  */
 __LJMP static struct hlua_txn *hlua_checktxn(lua_State *L, int ud)
 {
@@ -3277,8 +3277,8 @@
 
 	MAY_LJMP(check_args(L, 2, "set_priv"));
 
-	/* It is useles to retrieve the session, but this function
-	 * runs only in a session context.
+	/* It is useles to retrieve the stream, but this function
+	 * runs only in a stream context.
 	 */
 	MAY_LJMP(hlua_checktxn(L, 1));
 	hlua = hlua_gethlua(L);
@@ -3300,8 +3300,8 @@
 
 	MAY_LJMP(check_args(L, 1, "get_priv"));
 
-	/* It is useles to retrieve the session, but this function
-	 * runs only in a session context.
+	/* It is useles to retrieve the stream, but this function
+	 * runs only in a stream context.
 	 */
 	MAY_LJMP(hlua_checktxn(L, 1));
 	hlua = hlua_gethlua(L);
@@ -3316,7 +3316,7 @@
  * return 0 if the stack does not contains free slots,
  * otherwise it returns 1.
  */
-static int hlua_txn_new(lua_State *L, struct session *s, struct proxy *p, void *l7)
+static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p, void *l7)
 {
 	struct hlua_txn *htxn;
 
@@ -3806,79 +3806,79 @@
  * doesn't allow "yield" functions because the HAProxy engine cannot
  * resume converters.
  */
-static int hlua_sample_conv_wrapper(struct session *session, const struct arg *arg_p,
+static int hlua_sample_conv_wrapper(struct stream *stream, const struct arg *arg_p,
                                     struct sample *smp, void *private)
 {
 	struct hlua_function *fcn = (struct hlua_function *)private;
 
-	/* In the execution wrappers linked with a session, the
+	/* In the execution wrappers linked with a stream, the
 	 * Lua context can be not initialized. This behavior
 	 * permits to save performances because a systematic
 	 * Lua initialization cause 5% performances loss.
 	 */
-	if (!session->hlua.T && !hlua_ctx_init(&session->hlua, session->task)) {
-		send_log(session->be, LOG_ERR, "Lua converter '%s': can't initialize Lua context.", fcn->name);
+	if (!stream->hlua.T && !hlua_ctx_init(&stream->hlua, stream->task)) {
+		send_log(stream->be, LOG_ERR, "Lua converter '%s': can't initialize Lua context.", fcn->name);
 		if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
 			Alert("Lua converter '%s': can't initialize Lua context.\n", fcn->name);
 		return 0;
 	}
 
 	/* If it is the first run, initialize the data for the call. */
-	if (!HLUA_IS_RUNNING(&session->hlua)) {
+	if (!HLUA_IS_RUNNING(&stream->hlua)) {
 		/* Check stack available size. */
-		if (!lua_checkstack(session->hlua.T, 1)) {
-			send_log(session->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name);
+		if (!lua_checkstack(stream->hlua.T, 1)) {
+			send_log(stream->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name);
 			if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
 				Alert("Lua converter '%s': full stack.\n", fcn->name);
 			return 0;
 		}
 
 		/* Restore the function in the stack. */
-		lua_rawgeti(session->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref);
+		lua_rawgeti(stream->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref);
 
 		/* convert input sample and pust-it in the stack. */
-		if (!lua_checkstack(session->hlua.T, 1)) {
-			send_log(session->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name);
+		if (!lua_checkstack(stream->hlua.T, 1)) {
+			send_log(stream->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name);
 			if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
 				Alert("Lua converter '%s': full stack.\n", fcn->name);
 			return 0;
 		}
-		hlua_smp2lua(session->hlua.T, smp);
-		session->hlua.nargs = 2;
+		hlua_smp2lua(stream->hlua.T, smp);
+		stream->hlua.nargs = 2;
 
 		/* push keywords in the stack. */
 		if (arg_p) {
 			for (; arg_p->type != ARGT_STOP; arg_p++) {
-				if (!lua_checkstack(session->hlua.T, 1)) {
-					send_log(session->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name);
+				if (!lua_checkstack(stream->hlua.T, 1)) {
+					send_log(stream->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name);
 					if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
 						Alert("Lua converter '%s': full stack.\n", fcn->name);
 					return 0;
 				}
-				hlua_arg2lua(session->hlua.T, arg_p);
-				session->hlua.nargs++;
+				hlua_arg2lua(stream->hlua.T, arg_p);
+				stream->hlua.nargs++;
 			}
 		}
 
 		/* We must initialize the execution timeouts. */
-		session->hlua.expire = tick_add(now_ms, hlua_timeout_session);
+		stream->hlua.expire = tick_add(now_ms, hlua_timeout_session);
 
 		/* Set the currently running flag. */
-		HLUA_SET_RUN(&session->hlua);
+		HLUA_SET_RUN(&stream->hlua);
 	}
 
 	/* Execute the function. */
-	switch (hlua_ctx_resume(&session->hlua, 0)) {
+	switch (hlua_ctx_resume(&stream->hlua, 0)) {
 	/* finished. */
 	case HLUA_E_OK:
 		/* Convert the returned value in sample. */
-		hlua_lua2smp(session->hlua.T, -1, smp);
-		lua_pop(session->hlua.T, 1);
+		hlua_lua2smp(stream->hlua.T, -1, smp);
+		lua_pop(stream->hlua.T, 1);
 		return 1;
 
 	/* yield. */
 	case HLUA_E_AGAIN:
-		send_log(session->be, LOG_ERR, "Lua converter '%s': cannot use yielded functions.", fcn->name);
+		send_log(stream->be, LOG_ERR, "Lua converter '%s': cannot use yielded functions.", fcn->name);
 		if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
 			Alert("Lua converter '%s': cannot use yielded functions.\n", fcn->name);
 		return 0;
@@ -3886,15 +3886,15 @@
 	/* finished with error. */
 	case HLUA_E_ERRMSG:
 		/* Display log. */
-		send_log(session->be, LOG_ERR, "Lua converter '%s': %s.", fcn->name, lua_tostring(session->hlua.T, -1));
+		send_log(stream->be, LOG_ERR, "Lua converter '%s': %s.", fcn->name, lua_tostring(stream->hlua.T, -1));
 		if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
-			Alert("Lua converter '%s': %s.\n", fcn->name, lua_tostring(session->hlua.T, -1));
-		lua_pop(session->hlua.T, 1);
+			Alert("Lua converter '%s': %s.\n", fcn->name, lua_tostring(stream->hlua.T, -1));
+		lua_pop(stream->hlua.T, 1);
 		return 0;
 
 	case HLUA_E_ERR:
 		/* Display log. */
-		send_log(session->be, LOG_ERR, "Lua converter '%s' returns an unknown error.", fcn->name);
+		send_log(stream->be, LOG_ERR, "Lua converter '%s' returns an unknown error.", fcn->name);
 		if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
 			Alert("Lua converter '%s' returns an unknown error.\n", fcn->name);
 
@@ -3907,13 +3907,13 @@
  * doesn't allow "yield" functions because the HAProxy engine cannot
  * resume sample-fetches.
  */
-static int hlua_sample_fetch_wrapper(struct proxy *px, struct session *s, void *l7,
+static int hlua_sample_fetch_wrapper(struct proxy *px, struct stream *s, void *l7,
                                      unsigned int opt, const struct arg *arg_p,
                                      struct sample *smp, const char *kw, void *private)
 {
 	struct hlua_function *fcn = (struct hlua_function *)private;
 
-	/* In the execution wrappers linked with a session, the
+	/* In the execution wrappers linked with a stream, the
 	 * Lua context can be not initialized. This behavior
 	 * permits to save performances because a systematic
 	 * Lua initialization cause 5% performances loss.
@@ -4188,12 +4188,12 @@
  * returns a yield.
  */
 static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px,
-                                    struct session *s, struct http_txn *http_txn,
+                                    struct stream *s, struct http_txn *http_txn,
                                     unsigned int analyzer)
 {
 	char **arg;
 
-	/* In the execution wrappers linked with a session, the
+	/* In the execution wrappers linked with a stream, the
 	 * Lua context can be not initialized. This behavior
 	 * permits to save performances because a systematic
 	 * Lua initialization cause 5% performances loss.
@@ -4218,7 +4218,7 @@
 		/* Restore the function in the stack. */
 		lua_rawgeti(s->hlua.T, LUA_REGISTRYINDEX, rule->fcn.function_ref);
 
-		/* Create and and push object session in the stack. */
+		/* Create and and push object stream in the stack. */
 		if (!hlua_txn_new(s->hlua.T, s, px, http_txn)) {
 			send_log(px, LOG_ERR, "Lua function '%s': full stack.", rule->fcn.name);
 			if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
@@ -4298,7 +4298,7 @@
  * "hlua_request_act_wrapper" for executing the LUA code.
  */
 int hlua_tcp_req_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
-                             struct session *s)
+                             struct stream *s)
 {
 	return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data,
 	                                px, s, NULL, AN_REQ_INSPECT_FE);
@@ -4308,7 +4308,7 @@
  * "hlua_request_act_wrapper" for executing the LUA code.
  */
 int hlua_tcp_res_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
-                             struct session *s)
+                             struct stream *s)
 {
 	return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data,
 	                                px, s, NULL, AN_RES_INSPECT);
@@ -4319,7 +4319,7 @@
  * the LUA code.
  */
 int hlua_http_req_act_wrapper(struct http_req_rule *rule, struct proxy *px,
-                              struct session *s, struct http_txn *http_txn)
+                              struct stream *s, struct http_txn *http_txn)
 {
 	return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px,
 	                                s, http_txn, AN_REQ_HTTP_PROCESS_FE);
@@ -4330,7 +4330,7 @@
  * the LUA code.
  */
 int hlua_http_res_act_wrapper(struct http_res_rule *rule, struct proxy *px,
-                              struct session *s, struct http_txn *http_txn)
+                              struct stream *s, struct http_txn *http_txn)
 {
 	return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px,
 	                                s, http_txn, AN_RES_HTTP_PROCESS_BE);
@@ -4613,7 +4613,7 @@
 	};
 #endif
 
-	/* Initialise com signals pool session. */
+	/* Initialise com signals pool */
 	pool2_hlua_com = create_pool("hlua_com", sizeof(struct hlua_com), MEM_F_SHARED);
 
 	/* Register configuration keywords. */
diff --git a/src/listener.c b/src/listener.c
index 349c204..6b5fc6a 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -169,7 +169,7 @@
 	return 1;
 }
 
-/* Marks a ready listener as full so that the session code tries to re-enable
+/* Marks a ready listener as full so that the stream code tries to re-enable
  * it upon next close() using resume_listener().
  */
 void listener_full(struct listener *l)
@@ -466,7 +466,7 @@
 
 		ret = l->accept(l, cfd, &addr);
 		if (unlikely(ret <= 0)) {
-			/* The connection was closed by session_accept(). Either
+			/* The connection was closed by stream_accept(). Either
 			 * we just have to ignore it (ret == 0) or it's a critical
 			 * error due to a resource shortage, and we must stop the
 			 * listener (ret < 0).
@@ -589,7 +589,7 @@
 
 /* set temp integer to the number of connexions to the same listening socket */
 static int
-smp_fetch_dconn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_dconn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_UINT;
@@ -599,7 +599,7 @@
 
 /* set temp integer to the id of the socket (listener) */
 static int
-smp_fetch_so_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_so_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_UINT;
diff --git a/src/log.c b/src/log.c
index 20a98b2..f9c78a2 100644
--- a/src/log.c
+++ b/src/log.c
@@ -916,7 +916,7 @@
  * not counting the trailing zero which is always added if the resulting size
  * is not zero.
  */
-int build_logline(struct session *s, char *dst, size_t maxsize, struct list *list_format)
+int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list_format)
 {
 	struct proxy *fe = s->fe;
 	struct proxy *be = s->be;
@@ -1599,10 +1599,10 @@
 }
 
 /*
- * send a log for the session when we have enough info about it.
+ * send a log for the stream when we have enough info about it.
  * Will not log if the frontend has no log defined.
  */
-void sess_log(struct session *s)
+void strm_log(struct stream *s)
 {
 	char *tmplog;
 	int size, err, level;
diff --git a/src/map.c b/src/map.c
index 451fad6..3fb84ac 100644
--- a/src/map.c
+++ b/src/map.c
@@ -164,7 +164,7 @@
 	return 1;
 }
 
-static int sample_conv_map(struct session *session, const struct arg *arg_p,
+static int sample_conv_map(struct stream *stream, const struct arg *arg_p,
                            struct sample *smp, void *private)
 {
 	struct map_descriptor *desc;
diff --git a/src/payload.c b/src/payload.c
index b5d8478..3a2dc15 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -29,7 +29,7 @@
  * used with content inspection.
  */
 static int
-smp_fetch_wait_end(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_wait_end(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                    const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	if (!(opt & SMP_OPT_FINAL)) {
@@ -43,7 +43,7 @@
 
 /* return the number of bytes in the request buffer */
 static int
-smp_fetch_len(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_len(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct channel *chn;
@@ -63,7 +63,7 @@
 
 /* returns the type of SSL hello message (mainly used to detect an SSL hello) */
 static int
-smp_fetch_ssl_hello_type(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_ssl_hello_type(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                          const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int hs_len;
@@ -134,7 +134,7 @@
  * Note: this decoder only works with non-wrapping data.
  */
 static int
-smp_fetch_req_ssl_ver(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_req_ssl_ver(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int version, bleft, msg_len;
@@ -270,7 +270,7 @@
  *             - opaque hostname[name_len bytes]
  */
 static int
-smp_fetch_ssl_hello_sni(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_ssl_hello_sni(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int hs_len, ext_len, bleft;
@@ -410,7 +410,7 @@
  * of type SMP_T_CSTR. Note: this decoder only works with non-wrapping data.
  */
 int
-fetch_rdp_cookie_name(struct session *s, struct sample *smp, const char *cname, int clen)
+fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, int clen)
 {
 	int bleft;
 	const unsigned char *data;
@@ -502,7 +502,7 @@
  * returned sample has type SMP_T_CSTR.
  */
 int
-smp_fetch_rdp_cookie(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_rdp_cookie(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	return fetch_rdp_cookie_name(s, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
@@ -510,7 +510,7 @@
 
 /* returns either 1 or 0 depending on whether an RDP cookie is found or not */
 static int
-smp_fetch_rdp_cookie_cnt(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_rdp_cookie_cnt(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                          const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int ret;
@@ -528,7 +528,7 @@
 
 /* extracts part of a payload with offset and length at a given position */
 static int
-smp_fetch_payload_lv(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_payload_lv(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                      const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
 {
 	unsigned int len_offset = arg_p[0].data.uint;
@@ -585,7 +585,7 @@
 
 /* extracts some payload at a fixed position and length */
 static int
-smp_fetch_payload(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_payload(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                   const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
 {
 	unsigned int buf_offset = arg_p[0].data.uint;
diff --git a/src/peers.c b/src/peers.c
index 3cd4412..a2f29d2 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -38,7 +38,7 @@
 #include <proto/proto_tcp.h>
 #include <proto/proto_http.h>
 #include <proto/proxy.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/signal.h>
 #include <proto/stick_table.h>
 #include <proto/stream_interface.h>
@@ -120,7 +120,7 @@
 #define PEER_SESSION_PROTO_NAME         "HAProxyS"
 
 struct peers *peers = NULL;
-static void peer_session_forceshutdown(struct session * session);
+static void peer_session_forceshutdown(struct stream * stream);
 
 
 /*
@@ -179,7 +179,7 @@
  */
 static void peer_session_release(struct stream_interface *si)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct appctx *appctx = objt_appctx(si->end);
 	struct peer_session *ps = (struct peer_session *)appctx->ctx.peers.ptr;
 
@@ -189,8 +189,8 @@
 
 	/* peer session identified */
 	if (ps) {
-		if (ps->session == s) {
-			ps->session = NULL;
+		if (ps->stream == s) {
+			ps->stream = NULL;
 			if (ps->flags & PEER_F_LEARN_ASSIGN) {
 				/* unassign current peer for learning */
 				ps->flags &= ~(PEER_F_LEARN_ASSIGN);
@@ -213,7 +213,7 @@
  */
 static void peer_io_handler(struct stream_interface *si)
 {
-	struct session *s = si_sess(si);
+	struct stream *s = si_strm(si);
 	struct peers *curpeers = (struct peers *)s->fe->parent;
 	struct appctx *appctx = objt_appctx(si->end);
 	int reql = 0;
@@ -405,20 +405,20 @@
 							goto switchstate;
 						}
 
-						/* lookup peer session of current peer */
+						/* lookup peer stream of current peer */
 						for (ps = st->sessions; ps; ps = ps->next) {
 							if (ps->peer == curpeer) {
-								/* If session already active, replaced by new one */
-								if (ps->session && ps->session != s) {
+								/* If stream already active, replaced by new one */
+								if (ps->stream && ps->stream != s) {
 									if (ps->peer->local) {
 										/* Local connection, reply a retry */
 										appctx->st0 = PEER_SESS_ST_EXIT;
 										appctx->st1 = PEER_SESS_SC_TRYAGAIN;
 										goto switchstate;
 									}
-									peer_session_forceshutdown(ps->session);
+									peer_session_forceshutdown(ps->stream);
 								}
-								ps->session = s;
+								ps->stream = s;
 								break;
 							}
 						}
@@ -1063,20 +1063,20 @@
 /*
  * Use this function to force a close of a peer session
  */
-static void peer_session_forceshutdown(struct session * session)
+static void peer_session_forceshutdown(struct stream * stream)
 {
 	struct stream_interface *oldsi = NULL;
 	struct appctx *appctx = NULL;
 	int i;
 
 	for (i = 0; i <= 1; i++) {
-		appctx = objt_appctx(session->si[i].end);
+		appctx = objt_appctx(stream->si[i].end);
 		if (!appctx)
 			continue;
 		if (appctx->applet != &peer_applet)
 			continue;
 
-		oldsi = &session->si[i];
+		oldsi = &stream->si[i];
 		break;
 	}
 
@@ -1087,7 +1087,7 @@
 	peer_session_release(oldsi);
 	appctx->st0 = PEER_SESS_ST_END;
 	appctx->ctx.peers.ptr = NULL;
-	task_wakeup(session->task, TASK_WOKEN_MSG);
+	task_wakeup(stream->task, TASK_WOKEN_MSG);
 }
 
 /* Pre-configures a peers frontend to accept incoming connections */
@@ -1106,22 +1106,22 @@
 /*
  * Create a new peer session in assigned state (connect will start automatically)
  */
-static struct session *peer_session_create(struct peer *peer, struct peer_session *ps)
+static struct stream *peer_session_create(struct peer *peer, struct peer_session *ps)
 {
 	struct listener *l = LIST_NEXT(&peer->peers->peers_fe->conf.listeners, struct listener *, by_fe);
 	struct proxy *p = (struct proxy *)l->frontend; /* attached frontend */
 	struct appctx *appctx;
-	struct session *s;
+	struct stream *s;
 	struct http_txn *txn;
 	struct task *t;
 	struct connection *conn;
 
-	if ((s = pool_alloc2(pool2_session)) == NULL) { /* disable this proxy for a while */
+	if ((s = pool_alloc2(pool2_stream)) == NULL) { /* disable this proxy for a while */
 		Alert("out of memory in peer_session_create().\n");
 		goto out_close;
 	}
 
-	LIST_ADDQ(&sessions, &s->list);
+	LIST_ADDQ(&streams, &s->list);
 	LIST_INIT(&s->back_refs);
 	LIST_INIT(&s->buffer_wait);
 
@@ -1145,7 +1145,7 @@
 	s->task = t;
 	s->listener = l;
 
-	/* Note: initially, the session's backend points to the frontend.
+	/* Note: initially, the stream's backend points to the frontend.
 	 * This changes later when switching rules are executed or
 	 * when the default backend is assigned.
 	 */
@@ -1188,7 +1188,7 @@
 	conn->target = s->target = &s->be->obj_type;
 	memcpy(&conn->addr.to, &peer->addr, sizeof(conn->addr.to));
 
-	session_init_srv_conn(s);
+	stream_init_srv_conn(s);
 	s->pend_pos = NULL;
 
 	/* init store persistence */
@@ -1214,7 +1214,7 @@
 
 	txn = &s->txn;
 	/* Those variables will be checked and freed if non-NULL in
-	 * session.c:session_free(). It is important that they are
+	 * stream.c:stream_free(). It is important that they are
 	 * properly initialized.
 	 */
 	txn->sessid = NULL;
@@ -1277,7 +1277,7 @@
 	task_free(t);
  out_free_session:
 	LIST_DEL(&s->list);
-	pool_free2(pool2_session, s);
+	pool_free2(pool2_stream, s);
  out_close:
 	return s;
 }
@@ -1314,20 +1314,20 @@
 		for (ps = st->sessions; ps; ps = ps->next) {
 			/* For each remote peers */
 			if (!ps->peer->local) {
-				if (!ps->session) {
-					/* no active session */
+				if (!ps->stream) {
+					/* no active stream */
 					if (ps->statuscode == 0 ||
 					    ps->statuscode == PEER_SESS_SC_SUCCESSCODE ||
 					    ((ps->statuscode == PEER_SESS_SC_CONNECTCODE ||
 					      ps->statuscode == PEER_SESS_SC_CONNECTEDCODE) &&
 					     tick_is_expired(ps->reconnect, now_ms))) {
 						/* connection never tried
-						 * or previous session established with success
-						 * or previous session failed during connection
+						 * or previous stream established with success
+						 * or previous stream failed during connection
 						 * and reconnection timer is expired */
 
 						/* retry a connect */
-						ps->session = peer_session_create(ps->peer, ps);
+						ps->stream = peer_session_create(ps->peer, ps);
 					}
 					else if (ps->statuscode == PEER_SESS_SC_CONNECTCODE ||
 						 ps->statuscode == PEER_SESS_SC_CONNECTEDCODE) {
@@ -1338,9 +1338,9 @@
 						task->expire = tick_first(task->expire, ps->reconnect);
 					}
 					/* else do nothing */
-				} /* !ps->session */
+				} /* !ps->stream */
 				else if (ps->statuscode == PEER_SESS_SC_SUCCESSCODE) {
-					/* current session is active and established */
+					/* current stream is active and established */
 					if (((st->flags & SHTABLE_RESYNC_STATEMASK) == SHTABLE_RESYNC_FROMREMOTE) &&
 					    !(st->flags & SHTABLE_F_RESYNC_ASSIGN) &&
 					    !(ps->flags & PEER_F_LEARN_NOTUP2DATE)) {
@@ -1352,12 +1352,12 @@
 						ps->flags |= PEER_F_LEARN_ASSIGN;
 						st->flags |= SHTABLE_F_RESYNC_ASSIGN;
 
-						/* awake peer session task to handle a request of resync */
-						task_wakeup(ps->session->task, TASK_WOKEN_MSG);
+						/* awake peer stream task to handle a request of resync */
+						task_wakeup(ps->stream->task, TASK_WOKEN_MSG);
 					}
 					else if ((int)(ps->pushed - ps->table->table->localupdate) < 0) {
-						/* awake peer session task to push local updates */
-						task_wakeup(ps->session->task, TASK_WOKEN_MSG);
+						/* awake peer stream task to push local updates */
+						task_wakeup(ps->stream->task, TASK_WOKEN_MSG);
 					}
 					/* else do nothing */
 				} /* SUCCESSCODE */
@@ -1395,9 +1395,9 @@
 
 			/* disconnect all connected peers */
 			for (ps = st->sessions; ps; ps = ps->next) {
-				if (ps->session) {
-					peer_session_forceshutdown(ps->session);
-					ps->session = NULL;
+				if (ps->stream) {
+					peer_session_forceshutdown(ps->stream);
+					ps->stream = NULL;
 				}
 			}
 		}
@@ -1411,19 +1411,19 @@
 				st->table->syncing--;
 			}
 		}
-		else if (!ps->session) {
-			/* If session is not active */
+		else if (!ps->stream) {
+			/* If stream is not active */
 			if (ps->statuscode == 0 ||
 			    ps->statuscode == PEER_SESS_SC_SUCCESSCODE ||
 			    ps->statuscode == PEER_SESS_SC_CONNECTEDCODE ||
 			    ps->statuscode == PEER_SESS_SC_TRYAGAIN) {
 				/* connection never tried
-				 * or previous session was successfully established
-				 * or previous session tcp connect success but init state incomplete
+				 * or previous stream was successfully established
+				 * or previous stream tcp connect success but init state incomplete
 				 * or during previous connect, peer replies a try again statuscode */
 
 				/* connect to the peer */
-				ps->session = peer_session_create(ps->peer, ps);
+				ps->stream = peer_session_create(ps->peer, ps);
 			}
 			else {
 				/* Other error cases */
@@ -1437,9 +1437,9 @@
 		}
 		else if (ps->statuscode == PEER_SESS_SC_SUCCESSCODE &&
 		         (int)(ps->pushed - ps->table->table->localupdate) < 0) {
-			/* current session active and established
-			   awake session to push remaining local updates */
-			task_wakeup(ps->session->task, TASK_WOKEN_MSG);
+			/* current stream active and established
+			   awake stream to push remaining local updates */
+			task_wakeup(ps->stream->task, TASK_WOKEN_MSG);
 		}
 	} /* stopping */
 	/* Wakeup for re-connect */
diff --git a/src/proto_http.c b/src/proto_http.c
index 90176fc..2df2ce8 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -61,7 +61,7 @@
 #include <proto/queue.h>
 #include <proto/sample.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 #include <proto/pattern.h>
@@ -252,7 +252,7 @@
 #error "Check if your OS uses bitfields for fd_sets"
 #endif
 
-static int http_apply_redirect_rule(struct redirect_rule *rule, struct session *s, struct http_txn *txn);
+static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn);
 
 void init_proto_http()
 {
@@ -823,7 +823,7 @@
  * The error flags are set to the values in arguments. Any pending request
  * in this buffer will be lost.
  */
-static void http_server_error(struct session *s, struct stream_interface *si,
+static void http_server_error(struct stream *s, struct stream_interface *si,
 			      int err, int finst, int status, const struct chunk *msg)
 {
 	channel_auto_read(si_oc(si));
@@ -842,11 +842,11 @@
 		s->flags |= finst;
 }
 
-/* This function returns the appropriate error location for the given session
+/* This function returns the appropriate error location for the given stream
  * and message.
  */
 
-struct chunk *http_error_message(struct session *s, int msgnum)
+struct chunk *http_error_message(struct stream *s, int msgnum)
 {
 	if (s->be->errmsg[msgnum].str)
 		return &s->be->errmsg[msgnum];
@@ -974,7 +974,7 @@
  * follow normal proxy processing. NOTE: this function is designed to support
  * being called once data are scheduled for forwarding.
  */
-void http_perform_server_redirect(struct session *s, struct stream_interface *si)
+void http_perform_server_redirect(struct stream *s, struct stream_interface *si)
 {
 	struct http_txn *txn;
 	struct server *srv;
@@ -1050,7 +1050,7 @@
  * Note that connection errors appearing on the second request of a keep-alive
  * connection are not reported since this allows the client to retry.
  */
-void http_return_srv_error(struct session *s, struct stream_interface *si)
+void http_return_srv_error(struct stream *s, struct stream_interface *si)
 {
 	int err_type = si->err_type;
 
@@ -1423,7 +1423,7 @@
  * or auth method is unknown auth_method is set to HTTP_AUTH_WRONG to avoid
  * searching again for something we are unable to find anyway. However, if
  * the result if valid, the cache is not reused because we would risk to
- * have the credentials overwritten by another session in parallel.
+ * have the credentials overwritten by another stream in parallel.
  */
 
 /* This bufffer is initialized in the file 'src/haproxy.c'. This length is
@@ -1432,7 +1432,7 @@
 char *get_http_auth_buff;
 
 int
-get_http_auth(struct session *s)
+get_http_auth(struct stream *s)
 {
 
 	struct http_txn *txn = &s->txn;
@@ -1442,7 +1442,7 @@
 	int len;
 
 #ifdef DEBUG_AUTH
-	printf("Auth for session %p: %d\n", s, txn->auth.method);
+	printf("Auth for stream %p: %d\n", s, txn->auth.method);
 #endif
 
 	if (txn->auth.method == HTTP_AUTH_WRONG)
@@ -2236,7 +2236,7 @@
 /*
  * Selects a compression algorithm depending on the client request.
  */
-int select_compression_request_header(struct session *s, struct buffer *req)
+int select_compression_request_header(struct stream *s, struct buffer *req)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &txn->req;
@@ -2347,7 +2347,7 @@
 /*
  * Selects a comression algorithm depending of the server response.
  */
-int select_compression_response_header(struct session *s, struct buffer *res)
+int select_compression_response_header(struct stream *s, struct buffer *res)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &txn->rsp;
@@ -2460,7 +2460,7 @@
 	return 0;
 }
 
-void http_adjust_conn_mode(struct session *s, struct http_txn *txn, struct http_msg *msg)
+void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_msg *msg)
 {
 	int tmp = TX_CON_WANT_KAL;
 
@@ -2521,7 +2521,7 @@
  * when it has nothing left to do, and may remove any analyser when it wants to
  * abort.
  */
-int http_wait_for_request(struct session *s, struct channel *req, int an_bit)
+int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
 {
 	/*
 	 * We will parse the partial (or complete) lines.
@@ -2550,7 +2550,7 @@
 	struct http_msg *msg = &txn->req;
 	struct hdr_ctx ctx;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -2642,10 +2642,10 @@
 	 * A full request is indicated by the fact that we have seen
 	 * the double LF/CRLF, so the state is >= HTTP_MSG_BODY. Invalid
 	 * requests are checked first. When waiting for a second request
-	 * on a keep-alive session, if we encounter and error, close, t/o,
-	 * we note the error in the session flags but don't set any state.
+	 * on a keep-alive stream, if we encounter and error, close, t/o,
+	 * we note the error in the stream flags but don't set any state.
 	 * Since the error will be noted there, it will not be counted by
-	 * process_session() as a frontend error.
+	 * process_stream() as a frontend error.
 	 * Last, we may increase some tracked counters' http request errors on
 	 * the cases that are deliberately the client's fault. For instance,
 	 * a timeout or connection reset is not counted as an error. However
@@ -2657,23 +2657,23 @@
 		 * First, let's catch bad requests.
 		 */
 		if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) {
-			session_inc_http_req_ctr(s);
-			session_inc_http_err_ctr(s);
+			stream_inc_http_req_ctr(s);
+			stream_inc_http_err_ctr(s);
 			proxy_inc_fe_req_ctr(s->fe);
 			goto return_bad_req;
 		}
 
 		/* 1: Since we are in header mode, if there's no space
 		 *    left for headers, we won't be able to free more
-		 *    later, so the session will never terminate. We
+		 *    later, so the stream will never terminate. We
 		 *    must terminate it now.
 		 */
 		if (unlikely(buffer_full(req->buf, global.tune.maxrewrite))) {
 			/* FIXME: check if URI is set and return Status
 			 * 414 Request URI too long instead.
 			 */
-			session_inc_http_req_ctr(s);
-			session_inc_http_err_ctr(s);
+			stream_inc_http_req_ctr(s);
+			stream_inc_http_err_ctr(s);
 			proxy_inc_fe_req_ctr(s->fe);
 			if (msg->err_pos < 0)
 				msg->err_pos = req->buf->i;
@@ -2691,7 +2691,7 @@
 			/* we cannot return any message on error */
 			if (msg->err_pos >= 0) {
 				http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
-				session_inc_http_err_ctr(s);
+				stream_inc_http_err_ctr(s);
 			}
 
 			txn->status = 400;
@@ -2699,7 +2699,7 @@
 			msg->msg_state = HTTP_MSG_ERROR;
 			req->analysers = 0;
 
-			session_inc_http_req_ctr(s);
+			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(s->fe);
 			s->fe->fe_counters.failed_req++;
 			if (s->listener->counters)
@@ -2721,14 +2721,14 @@
 			/* read timeout : give up with an error message. */
 			if (msg->err_pos >= 0) {
 				http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
-				session_inc_http_err_ctr(s);
+				stream_inc_http_err_ctr(s);
 			}
 			txn->status = 408;
 			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_408));
 			msg->msg_state = HTTP_MSG_ERROR;
 			req->analysers = 0;
 
-			session_inc_http_req_ctr(s);
+			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(s->fe);
 			s->fe->fe_counters.failed_req++;
 			if (s->listener->counters)
@@ -2754,8 +2754,8 @@
 			msg->msg_state = HTTP_MSG_ERROR;
 			req->analysers = 0;
 
-			session_inc_http_err_ctr(s);
-			session_inc_http_req_ctr(s);
+			stream_inc_http_err_ctr(s);
+			stream_inc_http_req_ctr(s);
 			proxy_inc_fe_req_ctr(s->fe);
 			s->fe->fe_counters.failed_req++;
 			if (s->listener->counters)
@@ -2826,7 +2826,7 @@
 	 * (for instance in the absence of headers).
 	 */
 
-	session_inc_http_req_ctr(s);
+	stream_inc_http_req_ctr(s);
 	proxy_inc_fe_req_ctr(s->fe); /* one more valid request for this FE */
 
 	if (txn->flags & TX_WAIT_NEXT_RQ) {
@@ -3092,9 +3092,9 @@
  * and always relies on the stats applet to complete the job. It does not touch
  * analysers nor counters, which are left to the caller. It does not touch
  * s->target which is supposed to already point to the stats applet. The caller
- * is expected to have already assigned an appctx to the session.
+ * is expected to have already assigned an appctx to the stream.
  */
-int http_handle_stats(struct session *s, struct channel *req)
+int http_handle_stats(struct stream *s, struct channel *req)
 {
 	struct stats_admin_rule *stats_admin_rule;
 	struct stream_interface *si = &s->si[1];
@@ -3246,7 +3246,7 @@
 #endif
 }
 
-int http_transform_header_str(struct session* s, struct http_msg *msg,
+int http_transform_header_str(struct stream* s, struct http_msg *msg,
                               const char* name, unsigned int name_len,
                               const char *str, struct my_regex *re,
                               int action)
@@ -3299,7 +3299,7 @@
 	return 0;
 }
 
-static int http_transform_header(struct session* s, struct http_msg *msg,
+static int http_transform_header(struct stream* s, struct http_msg *msg,
                                  const char* name, unsigned int name_len,
                                  struct list *fmt, struct my_regex *re,
                                  int action)
@@ -3313,7 +3313,7 @@
 	return http_transform_header_str(s, msg, name, name_len, replace->str, re, action);
 }
 
-/* Executes the http-request rules <rules> for session <s>, proxy <px> and
+/* Executes the http-request rules <rules> for stream <s>, proxy <px> and
  * transaction <txn>. Returns the verdict of the first rule that prevents
  * further processing of the request (auth, deny, ...), and defaults to
  * HTTP_RULE_RES_STOP if it executed all rules or stopped on an allow, or
@@ -3321,7 +3321,7 @@
  * on txn->flags if it encounters a tarpit rule.
  */
 enum rule_result
-http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct session *s, struct http_txn *txn)
+http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn)
 {
 	struct connection *cli_conn;
 	struct http_req_rule *rule;
@@ -3385,7 +3385,7 @@
 			chunk_printf(&trash, (txn->flags & TX_USE_PX_CONN) ? HTTP_407_fmt : HTTP_401_fmt, auth_realm);
 			txn->status = (txn->flags & TX_USE_PX_CONN) ? 407 : 401;
 			stream_int_retnclose(&s->si[0], &trash);
-			session_inc_http_err_ctr(s);
+			stream_inc_http_err_ctr(s);
 			return HTTP_RULE_RES_ABRT;
 
 		case HTTP_REQ_ACT_REDIR:
@@ -3562,7 +3562,7 @@
 				key = stktable_fetch_key(t, s->be, s, &s->txn, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL);
 
 				if (key && (ts = stktable_get_entry(t, key))) {
-					session_track_stkctr(&s->stkctr[http_req_trk_idx(rule->action)], t, ts);
+					stream_track_stkctr(&s->stkctr[http_req_trk_idx(rule->action)], t, ts);
 
 					/* let's count a new HTTP request as it's the first time we do it */
 					ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
@@ -3587,7 +3587,7 @@
 }
 
 
-/* Executes the http-response rules <rules> for session <s>, proxy <px> and
+/* Executes the http-response rules <rules> for stream <s>, proxy <px> and
  * transaction <txn>. Returns 3 states: HTTP_RULE_RES_CONT, HTTP_RULE_RES_YIELD
  * or HTTP_RULE_RES_STOP. If *CONT is returned, the process can continue the
  * evaluation of next rule list. If *STOP is returned, the process must stop
@@ -3596,7 +3596,7 @@
  * the same context.
  */
 static enum rule_result
-http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct session *s, struct http_txn *txn)
+http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn)
 {
 	struct connection *cli_conn;
 	struct http_res_rule *rule;
@@ -3804,7 +3804,7 @@
  * returns non-zero on success, or zero in case of a, irrecoverable error such
  * as too large a request to build a valid response.
  */
-static int http_apply_redirect_rule(struct redirect_rule *rule, struct session *s, struct http_txn *txn)
+static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn)
 {
 	struct http_msg *msg = &txn->req;
 	const char *msg_fmt;
@@ -4063,7 +4063,7 @@
  * either needs more data or wants to immediately abort the request (eg: deny,
  * error, ...).
  */
-int http_process_req_common(struct session *s, struct channel *req, int an_bit, struct proxy *px)
+int http_process_req_common(struct stream *s, struct channel *req, int an_bit, struct proxy *px)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &txn->req;
@@ -4076,7 +4076,7 @@
 		goto return_prx_yield;
 	}
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -4086,7 +4086,7 @@
 		req->analysers);
 
 	/* just in case we have some per-backend tracking */
-	session_inc_be_http_req_ctr(s);
+	stream_inc_be_http_req_ctr(s);
 
 	/* evaluate http-request rules */
 	if (!LIST_ISEMPTY(&px->http_req_rules)) {
@@ -4245,7 +4245,7 @@
 	req->analyse_exp = tick_add_ifset(now_ms,  s->be->timeout.tarpit);
 	if (!req->analyse_exp)
 		req->analyse_exp = tick_add(now_ms, 0);
-	session_inc_http_err_ctr(s);
+	stream_inc_http_err_ctr(s);
 	s->fe->fe_counters.denied_req++;
 	if (s->fe != s->be)
 		s->be->be_counters.denied_req++;
@@ -4258,7 +4258,7 @@
 	txn->status = 403;
 	s->logs.tv_request = now;
 	stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_403));
-	session_inc_http_err_ctr(s);
+	stream_inc_http_err_ctr(s);
 	s->fe->fe_counters.denied_req++;
 	if (s->fe != s->be)
 		s->be->be_counters.denied_req++;
@@ -4303,7 +4303,7 @@
  * needs more data, encounters an error, or wants to immediately abort the
  * request. It relies on buffers flags, and updates s->req.analysers.
  */
-int http_process_request(struct session *s, struct channel *req, int an_bit)
+int http_process_request(struct stream *s, struct channel *req, int an_bit)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &txn->req;
@@ -4315,7 +4315,7 @@
 		return 0;
 	}
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -4650,7 +4650,7 @@
  * returns zero, at the beginning because it prevents any other processing
  * from occurring, and at the end because it terminates the request.
  */
-int http_process_tarpit(struct session *s, struct channel *req, int an_bit)
+int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
 {
 	struct http_txn *txn = &s->txn;
 
@@ -4695,7 +4695,7 @@
  * HTTP_MSG_CHK_SIZE, HTTP_MSG_DATA or HTTP_MSG_TRAILERS. It returns zero if it
  * needs to read more data, or 1 once it has completed its analysis.
  */
-int http_wait_for_request_body(struct session *s, struct channel *req, int an_bit)
+int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &s->txn.req;
@@ -4761,7 +4761,7 @@
 		if (!ret)
 			goto missing_data;
 		else if (ret < 0) {
-			session_inc_http_err_ctr(s);
+			stream_inc_http_err_ctr(s);
 			goto return_bad_req;
 		}
 	}
@@ -4891,7 +4891,7 @@
 /* Terminate current transaction and prepare a new one. This is very tricky
  * right now but it works.
  */
-void http_end_txn_clean_session(struct session *s)
+void http_end_txn_clean_session(struct stream *s)
 {
 	int prev_status = s->txn.status;
 
@@ -4918,7 +4918,7 @@
 	}
 
 	s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);
-	session_process_counters(s);
+	stream_process_counters(s);
 
 	if (s->txn.status) {
 		int n;
@@ -4953,8 +4953,8 @@
 	}
 
 	/* stop tracking content-based counters */
-	session_stop_content_counters(s);
-	session_update_time_stats(s);
+	stream_stop_content_counters(s);
+	stream_update_time_stats(s);
 
 	s->logs.accept_date = date; /* user-visible date for logging */
 	s->logs.tv_accept = now;  /* corrected date for internal use */
@@ -4995,7 +4995,7 @@
 	s->si[1].err_type  = SI_ET_NONE;
 	s->si[1].conn_retries = 0;  /* used for logging too */
 	s->si[1].exp       = TICK_ETERNITY;
-	s->si[1].flags    &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_session */
+	s->si[1].flags    &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_stream */
 	s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WAKE_CONNECT|CF_WROTE_DATA);
 	s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA);
 	s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST);
@@ -5060,7 +5060,7 @@
  * this function and its equivalent should loop until both return zero. It
  * can set its own state to DONE, CLOSING, CLOSED, TUNNEL, ERROR.
  */
-int http_sync_req_state(struct session *s)
+int http_sync_req_state(struct stream *s)
 {
 	struct channel *chn = &s->req;
 	struct http_txn *txn = &s->txn;
@@ -5080,7 +5080,7 @@
 		 * (eg: Linux).
 		 * Note that if we're using keep-alive on the client side, we'd
 		 * rather poll now and keep the polling enabled for the whole
-		 * session's life than enabling/disabling it between each
+		 * stream's life than enabling/disabling it between each
 		 * response and next request.
 		 */
 		if (((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_SCL) &&
@@ -5126,7 +5126,7 @@
 		else if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_CLO) {
 			/* Option forceclose is set, or either side wants to close,
 			 * let's enforce it now that we're not expecting any new
-			 * data to come. The caller knows the session is complete
+			 * data to come. The caller knows the stream is complete
 			 * once both states are CLOSED.
 			 */
 			if (!(chn->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
@@ -5198,7 +5198,7 @@
  * this function and its equivalent should loop until both return zero. It
  * can set its own state to DONE, CLOSING, CLOSED, TUNNEL, ERROR.
  */
-int http_sync_res_state(struct session *s)
+int http_sync_res_state(struct stream *s)
 {
 	struct channel *chn = &s->res;
 	struct http_txn *txn = &s->txn;
@@ -5254,7 +5254,7 @@
 		else if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_CLO) {
 			/* Option forceclose is set, or either side wants to close,
 			 * let's enforce it now that we're not expecting any new
-			 * data to come. The caller knows the session is complete
+			 * data to come. The caller knows the stream is complete
 			 * once both states are CLOSED.
 			 */
 			if (!(chn->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
@@ -5327,7 +5327,7 @@
 /* Resync the request and response state machines. Return 1 if either state
  * changes.
  */
-int http_resync_states(struct session *s)
+int http_resync_states(struct stream *s)
 {
 	struct http_txn *txn = &s->txn;
 	int old_req_state = txn->req.msg_state;
@@ -5399,11 +5399,11 @@
  * tunnel mode and we want to forward till the close. It's used both to forward
  * remaining data and to resync after end of body. It expects the msg_state to
  * be between MSG_BODY and MSG_DONE (inclusive). It returns zero if it needs to
- * read more data, or 1 once we can go on with next request or end the session.
+ * read more data, or 1 once we can go on with next request or end the stream.
  * When in MSG_DATA or MSG_TRAILERS, it will automatically forward chunk_len
  * bytes of pending data + the headers if not already done.
  */
-int http_request_forward_body(struct session *s, struct channel *req, int an_bit)
+int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &s->txn.req;
@@ -5498,7 +5498,7 @@
 			if (ret == 0)
 				goto missing_data;
 			else if (ret < 0) {
-				session_inc_http_err_ctr(s);
+				stream_inc_http_err_ctr(s);
 				if (msg->err_pos >= 0)
 					http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_SIZE, s->be);
 				goto return_bad_req;
@@ -5512,7 +5512,7 @@
 			if (ret == 0)
 				goto missing_data;
 			else if (ret < 0) {
-				session_inc_http_err_ctr(s);
+				stream_inc_http_err_ctr(s);
 				if (msg->err_pos >= 0)
 					http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_CRLF, s->be);
 				goto return_bad_req;
@@ -5525,7 +5525,7 @@
 			if (ret == 0)
 				goto missing_data;
 			else if (ret < 0) {
-				session_inc_http_err_ctr(s);
+				stream_inc_http_err_ctr(s);
 				if (msg->err_pos >= 0)
 					http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_TRAILERS, s->be);
 				goto return_bad_req;
@@ -5707,7 +5707,7 @@
  * when it has nothing left to do, and may remove any analyser when it wants to
  * abort.
  */
-int http_wait_for_response(struct session *s, struct channel *rep, int an_bit)
+int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &txn->rsp;
@@ -5716,7 +5716,7 @@
 	int cur_idx;
 	int n;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		rep,
@@ -5911,7 +5911,7 @@
 			if (!(s->flags & SN_FINST_MASK))
 				s->flags |= SN_FINST_H;
 
-			/* process_session() will take care of the error */
+			/* process_stream() will take care of the error */
 			return 0;
 		}
 
@@ -5958,7 +5958,7 @@
 			if (!(s->flags & SN_FINST_MASK))
 				s->flags |= SN_FINST_H;
 
-			/* process_session() will take care of the error */
+			/* process_stream() will take care of the error */
 			return 0;
 		}
 
@@ -5987,7 +5987,7 @@
 	 * vulnerability scan.
 	 */
 	if (n == 4)
-		session_inc_http_err_ctr(s);
+		stream_inc_http_err_ctr(s);
 
 	if (objt_server(s->target))
 		objt_server(s->target)->counters.p.http.rsp[n]++;
@@ -6274,7 +6274,7 @@
  * and updates s->res.analysers. It might make sense to explode it into several
  * other functions. It works like process_request (see indications above).
  */
-int http_process_res_common(struct session *s, struct channel *rep, int an_bit, struct proxy *px)
+int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &txn->rsp;
@@ -6282,7 +6282,7 @@
 	struct cond_wordlist *wl;
 	enum rule_result ret = HTTP_RULE_RES_CONT;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		rep,
@@ -6590,7 +6590,7 @@
  * tunnel mode and we want to forward till the close. It's used both to forward
  * remaining data and to resync after end of body. It expects the msg_state to
  * be between MSG_BODY and MSG_DONE (inclusive). It returns zero if it needs to
- * read more data, or 1 once we can go on with next request or end the session.
+ * read more data, or 1 once we can go on with next request or end the stream.
  *
  * It is capable of compressing response data both in content-length mode and
  * in chunked mode. The state machines follows different flows depending on
@@ -6613,7 +6613,7 @@
  * is performed at once on final states for all bytes parsed, or when leaving
  * on missing data.
  */
-int http_response_forward_body(struct session *s, struct channel *res, int an_bit)
+int http_response_forward_body(struct stream *s, struct channel *res, int an_bit)
 {
 	struct http_txn *txn = &s->txn;
 	struct http_msg *msg = &s->txn.rsp;
@@ -6865,7 +6865,7 @@
 	if ((msg->flags & HTTP_MSGF_TE_CHNK) || s->comp_algo)
 		res->flags |= CF_EXPECT_MORE;
 
-	/* the session handler will take care of timeouts and errors */
+	/* the stream handler will take care of timeouts and errors */
 	return 0;
 
  return_bad_res: /* let's centralize all bad responses */
@@ -6928,7 +6928,7 @@
  * Since it can manage the switch to another backend, it updates the per-proxy
  * DENY stats.
  */
-int apply_filter_to_req_headers(struct session *s, struct channel *req, struct hdr_exp *exp)
+int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hdr_exp *exp)
 {
 	char *cur_ptr, *cur_end, *cur_next;
 	int cur_idx, old_idx, last_hdr;
@@ -6974,7 +6974,7 @@
 					break;
 
 				/* Swithing Proxy */
-				session_set_backend(s, (struct proxy *)exp->replace);
+				stream_set_backend(s, (struct proxy *)exp->replace);
 				last_hdr = 1;
 				break;
 
@@ -7040,7 +7040,7 @@
  * Since it can manage the switch to another backend, it updates the per-proxy
  * DENY stats.
  */
-int apply_filter_to_req_line(struct session *s, struct channel *req, struct hdr_exp *exp)
+int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_exp *exp)
 {
 	char *cur_ptr, *cur_end;
 	int done;
@@ -7075,7 +7075,7 @@
 				break;
 
 			/* Swithing Proxy */
-			session_set_backend(s, (struct proxy *)exp->replace);
+			stream_set_backend(s, (struct proxy *)exp->replace);
 			done = 1;
 			break;
 
@@ -7129,12 +7129,12 @@
 
 
 /*
- * Apply all the req filters of proxy <px> to all headers in buffer <req> of session <s>.
+ * Apply all the req filters of proxy <px> to all headers in buffer <req> of stream <s>.
  * Returns 0 if everything is alright, or -1 in case a replacement lead to an
  * unparsable request. Since it can manage the switch to another backend, it
  * updates the per-proxy DENY stats.
  */
-int apply_filters_to_request(struct session *s, struct channel *req, struct proxy *px)
+int apply_filters_to_request(struct stream *s, struct channel *req, struct proxy *px)
 {
 	struct http_txn *txn = &s->txn;
 	struct hdr_exp *exp;
@@ -7189,9 +7189,9 @@
 
 /*
  * Try to retrieve the server associated to the appsession.
- * If the server is found, it's assigned to the session.
+ * If the server is found, it's assigned to the stream.
  */
-void manage_client_side_appsession(struct session *s, const char *buf, int len) {
+void manage_client_side_appsession(struct stream *s, const char *buf, int len) {
 	struct http_txn *txn = &s->txn;
 	appsess *asession = NULL;
 	char *sessid_temp = NULL;
@@ -7201,9 +7201,9 @@
 	}
 
 	if (s->be->options2 & PR_O2_AS_REQL) {
-		/* request-learn option is enabled : store the sessid in the session for future use */
+		/* request-learn option is enabled : store the sessid in the stream for future use */
 		if (txn->sessid != NULL) {
-			/* free previously allocated memory as we don't need the session id found in the URL anymore */
+			/* free previously allocated memory as we don't need the stream id found in the URL anymore */
 			pool_free2(apools.sessid, txn->sessid);
 		}
 
@@ -7342,7 +7342,7 @@
  * of the multiple very crappy and ambiguous syntaxes we have to support. it
  * highly recommended not to touch this part without a good reason !
  */
-void manage_client_side_cookies(struct session *s, struct channel *req)
+void manage_client_side_cookies(struct stream *s, struct channel *req)
 {
 	struct http_txn *txn = &s->txn;
 	int preserve_hdr;
@@ -7791,7 +7791,7 @@
 /* Iterate the same filter through all response headers contained in <rtr>.
  * Returns 1 if this filter can be stopped upon return, otherwise 0.
  */
-int apply_filter_to_resp_headers(struct session *s, struct channel *rtr, struct hdr_exp *exp)
+int apply_filter_to_resp_headers(struct stream *s, struct channel *rtr, struct hdr_exp *exp)
 {
 	char *cur_ptr, *cur_end, *cur_next;
 	int cur_idx, old_idx, last_hdr;
@@ -7882,7 +7882,7 @@
  * Returns 0 if nothing has been done, 1 if the filter has been applied,
  * or -1 if a replacement resulted in an invalid status line.
  */
-int apply_filter_to_sts_line(struct session *s, struct channel *rtr, struct hdr_exp *exp)
+int apply_filter_to_sts_line(struct stream *s, struct channel *rtr, struct hdr_exp *exp)
 {
 	char *cur_ptr, *cur_end;
 	int done;
@@ -7953,11 +7953,11 @@
 
 
 /*
- * Apply all the resp filters of proxy <px> to all headers in buffer <rtr> of session <s>.
+ * Apply all the resp filters of proxy <px> to all headers in buffer <rtr> of stream <s>.
  * Returns 0 if everything is alright, or -1 in case a replacement lead to an
  * unparsable response.
  */
-int apply_filters_to_response(struct session *s, struct channel *rtr, struct proxy *px)
+int apply_filters_to_response(struct stream *s, struct channel *rtr, struct proxy *px)
 {
 	struct http_txn *txn = &s->txn;
 	struct hdr_exp *exp;
@@ -8015,7 +8015,7 @@
  * desirable to call it only when needed. This function is also used when we
  * just need to know if there is a cookie (eg: for check-cache).
  */
-void manage_server_side_cookies(struct session *s, struct channel *res)
+void manage_server_side_cookies(struct stream *s, struct channel *res)
 {
 	struct http_txn *txn = &s->txn;
 	struct server *srv;
@@ -8315,7 +8315,7 @@
 					/* free a possibly previously allocated memory */
 					pool_free2(apools.sessid, txn->sessid);
 
-					/* Store the sessid in the session for future use */
+					/* Store the sessid in the stream for future use */
 					if ((txn->sessid = pool_alloc2(apools.sessid)) == NULL) {
 						Alert("Not enough Memory process_srv():asession->sessid:malloc().\n");
 						send_log(s->be, LOG_ALERT, "Not enough Memory process_srv():asession->sessid:malloc().\n");
@@ -8378,7 +8378,7 @@
 /*
  * Check if response is cacheable or not. Updates s->flags.
  */
-void check_response_for_cacheability(struct session *s, struct channel *rtr)
+void check_response_for_cacheability(struct stream *s, struct channel *rtr)
 {
 	struct http_txn *txn = &s->txn;
 	char *p1, *p2;
@@ -8465,9 +8465,9 @@
 
 /*
  * Try to retrieve a known appsession in the URI, then the associated server.
- * If the server is found, it's assigned to the session.
+ * If the server is found, it's assigned to the stream.
  */
-void get_srv_from_appsession(struct session *s, const char *begin, int len)
+void get_srv_from_appsession(struct stream *s, const char *begin, int len)
 {
 	char *end_params, *first_param, *cur_param, *next_param;
 	char separator;
@@ -8573,7 +8573,7 @@
  * parsing point. The function is able to deal with wrapping buffers. It always
  * displays buffers as a contiguous area starting at buf->p.
  */
-void http_capture_bad_message(struct error_snapshot *es, struct session *s,
+void http_capture_bad_message(struct error_snapshot *es, struct stream *s,
                               struct http_msg *msg,
 			      enum ht_state state, struct proxy *other_end)
 {
@@ -8751,7 +8751,7 @@
  * so it is safe to pass it a full buffer if needed. If <err> is not NULL, an
  * arrow is printed after the line which contains the pointer.
  */
-void debug_hdr(const char *dir, struct session *s, const char *start, const char *end)
+void debug_hdr(const char *dir, struct stream *s, const char *start, const char *end)
 {
 	int max;
 	chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id,
@@ -8770,11 +8770,11 @@
 }
 
 /*
- * Initialize a new HTTP transaction for session <s>. It is assumed that all
+ * Initialize a new HTTP transaction for stream <s>. It is assumed that all
  * the required fields are properly allocated and that we only need to (re)init
  * them. This should be used before processing any new request.
  */
-void http_init_txn(struct session *s)
+void http_init_txn(struct stream *s)
 {
 	struct http_txn *txn = &s->txn;
 	struct proxy *fe = s->fe;
@@ -8817,7 +8817,7 @@
 }
 
 /* to be used at the end of a transaction */
-void http_end_txn(struct session *s)
+void http_end_txn(struct stream *s)
 {
 	struct http_txn *txn = &s->txn;
 
@@ -8857,7 +8857,7 @@
 }
 
 /* to be used at the end of a transaction to prepare a new one */
-void http_reset_txn(struct session *s)
+void http_reset_txn(struct stream *s)
 {
 	http_end_txn(s);
 	http_init_txn(s);
@@ -8870,7 +8870,7 @@
 	s->be = s->fe;
 	s->logs.logwait = s->fe->to_log;
 	s->logs.level = 0;
-	session_del_srv_conn(s);
+	stream_del_srv_conn(s);
 	s->target = NULL;
 	/* re-init store persistence */
 	s->store_count = 0;
@@ -9855,7 +9855,7 @@
  *   1 if an HTTP message is ready
  */
 static int
-smp_prefetch_http(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_prefetch_http(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, int req_vol)
 {
 	struct http_txn *txn = l7;
@@ -9984,7 +9984,7 @@
  * This is intended to be used with pat_match_meth() only.
  */
 static int
-smp_fetch_meth(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_meth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int meth;
@@ -10038,7 +10038,7 @@
 }
 
 static int
-smp_fetch_rqver(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_rqver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10063,7 +10063,7 @@
 }
 
 static int
-smp_fetch_stver(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_stver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10092,7 +10092,7 @@
 
 /* 3. Check on Status Code. We manipulate integers here. */
 static int
-smp_fetch_stcode(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_stcode(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10115,7 +10115,7 @@
 
 /* 4. Check on URL/URI. A pointer to the URI is stored. */
 static int
-smp_fetch_url(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
               const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10130,7 +10130,7 @@
 }
 
 static int
-smp_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10149,7 +10149,7 @@
 }
 
 static int
-smp_fetch_url_port(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url_port(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                    const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10175,7 +10175,7 @@
  * returns full lines instead (useful for User-Agent or Date for example).
  */
 static int
-smp_fetch_fhdr(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_fhdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10231,7 +10231,7 @@
  * returns full lines instead (useful for User-Agent or Date for example).
  */
 static int
-smp_fetch_fhdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_fhdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10261,7 +10261,7 @@
 }
 
 static int
-smp_fetch_hdr_names(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_hdr_names(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10300,7 +10300,7 @@
  * headers are considered from the first one.
  */
 static int
-smp_fetch_hdr(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_hdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
               const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10355,7 +10355,7 @@
  * Accepts exactly 1 argument of type string.
  */
 static int
-smp_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_hdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10390,7 +10390,7 @@
  * may or may not be appropriate for everything.
  */
 static int
-smp_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_hdr_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                   const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int ret = smp_fetch_hdr(px, l4, l7, opt, args, smp, kw, private);
@@ -10408,7 +10408,7 @@
  * It returns an IPv4 or IPv6 address.
  */
 static int
-smp_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_hdr_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int ret;
@@ -10440,7 +10440,7 @@
  * the first '/' after the possible hostname, and ends before the possible '?'.
  */
 static int
-smp_fetch_path(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_path(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10473,7 +10473,7 @@
  * The returned sample is of type string.
  */
 static int
-smp_fetch_base(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_base(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10520,7 +10520,7 @@
  * high-traffic sites without having to store whole paths.
  */
 int
-smp_fetch_base32(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_base32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10568,7 +10568,7 @@
  * 8 bytes would still work.
  */
 static int
-smp_fetch_base32_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_base32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct chunk *temp;
@@ -10607,7 +10607,7 @@
  * of type string carrying the whole query string.
  */
 static int
-smp_fetch_query(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_query(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10632,7 +10632,7 @@
 }
 
 static int
-smp_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_proto_http(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
@@ -10648,7 +10648,7 @@
 
 /* return a valid test if the current request is the first one on the connection */
 static int
-smp_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_http_first_req(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                          const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	if (!s)
@@ -10661,7 +10661,7 @@
 
 /* Accepts exactly 1 argument of type userlist */
 static int
-smp_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_http_auth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 
@@ -10680,7 +10680,7 @@
 
 /* Accepts exactly 1 argument of type userlist */
 static int
-smp_fetch_http_auth_grp(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_http_auth_grp(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 
@@ -10809,7 +10809,7 @@
  * the "capture" option in the configuration file
  */
 static int
-smp_fetch_capture_header_req(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_capture_header_req(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct proxy *fe = l4->fe;
@@ -10836,7 +10836,7 @@
  * the "capture" option in the configuration file
  */
 static int
-smp_fetch_capture_header_res(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_capture_header_res(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct proxy *fe = l4->fe;
@@ -10861,7 +10861,7 @@
 
 /* Extracts the METHOD in the HTTP request, the txn->uri should be filled before the call */
 static int
-smp_fetch_capture_req_method(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_capture_req_method(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct chunk *temp;
@@ -10889,7 +10889,7 @@
 
 /* Extracts the path in the HTTP request, the txn->uri should be filled before the call  */
 static int
-smp_fetch_capture_req_uri(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_capture_req_uri(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct chunk *temp;
@@ -10928,7 +10928,7 @@
  * as a string (either "HTTP/1.0" or "HTTP/1.1").
  */
 static int
-smp_fetch_capture_req_ver(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_capture_req_ver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                           const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10952,7 +10952,7 @@
  * as a string (either "HTTP/1.0" or "HTTP/1.1").
  */
 static int
-smp_fetch_capture_res_ver(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_capture_res_ver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                           const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -10983,7 +10983,7 @@
  * The returned sample is of type CSTR. Can be used to parse cookies in other
  * files.
  */
-int smp_fetch_cookie(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+int smp_fetch_cookie(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -11082,7 +11082,7 @@
  * type UINT. Accepts exactly 1 argument of type string.
  */
 static int
-smp_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_cookie_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -11149,7 +11149,7 @@
  * takes a mandatory argument of type string. It relies on smp_fetch_cookie().
  */
 static int
-smp_fetch_cookie_val(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_cookie_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int ret = smp_fetch_cookie(px, l4, l7, opt, args, smp, kw, private);
@@ -11254,7 +11254,7 @@
 }
 
 static int
-smp_fetch_url_param(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url_param(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	char delim = '?';
@@ -11285,7 +11285,7 @@
  * above).
  */
 static int
-smp_fetch_url_param_val(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url_param_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int ret = smp_fetch_url_param(px, l4, l7, opt, args, smp, kw, private);
@@ -11309,7 +11309,7 @@
  * as well as the path
  */
 static int
-smp_fetch_url32(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct http_txn *txn = l7;
@@ -11357,7 +11357,7 @@
  * 8 bytes would still work.
  */
 static int
-smp_fetch_url32_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_url32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct chunk *temp;
@@ -11409,7 +11409,7 @@
  * adds an optional offset found in args[0] and emits a string representing
  * the date in RFC-1123/5322 format.
  */
-static int sample_conv_http_date(struct session *session, const struct arg *args,
+static int sample_conv_http_date(struct stream *stream, const struct arg *args,
                                  struct sample *smp, void *private)
 {
 	const char day[7][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
@@ -11461,7 +11461,7 @@
 }
 
 /* Arguments: The list of expected value, the number of parts returned and the separator */
-static int sample_conv_q_prefered(struct session *session, const struct arg *args,
+static int sample_conv_q_prefered(struct stream *stream, const struct arg *args,
                                   struct sample *smp, void *private)
 {
 	const char *al = smp->data.str.str;
@@ -11623,7 +11623,7 @@
  * string by the caller, event if the replacement query string is empty.
  */
 int http_replace_req_line(int action, const char *replace, int len,
-                          struct proxy *px, struct session *s, struct http_txn *txn)
+                          struct proxy *px, struct stream *s, struct http_txn *txn)
 {
 	char *cur_ptr, *cur_end;
 	int offset = 0;
@@ -11704,7 +11704,7 @@
  * http_action_set_req_line_exec(). It always returns 1. If an error occurs
  * the action is canceled, but the rule processing continue.
  */
-int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct session *s, struct http_txn *txn)
+int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct stream *s, struct http_txn *txn)
 {
 	chunk_reset(&trash);
 
@@ -11914,7 +11914,7 @@
 	{ "base32",          smp_fetch_base32,         0,                NULL,    SMP_T_UINT, SMP_USE_HRQHV },
 	{ "base32+src",      smp_fetch_base32_src,     0,                NULL,    SMP_T_BIN,  SMP_USE_HRQHV },
 
-	/* capture are allocated and are permanent in the session */
+	/* capture are allocated and are permanent in the stream */
 	{ "capture.req.hdr", smp_fetch_capture_header_req, ARG1(1, UINT), NULL,   SMP_T_STR,  SMP_USE_HRQHP },
 
 	/* retrieve these captures from the HTTP logs */
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index b1ce8b6..83669f3 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -51,7 +51,7 @@
 #include <proto/proto_tcp.h>
 #include <proto/proxy.h>
 #include <proto/sample.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/stick_table.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
@@ -1087,14 +1087,14 @@
  * function may be called for frontend rules and backend rules. It only relies
  * on the backend pointer so this works for both cases.
  */
-int tcp_inspect_request(struct session *s, struct channel *req, int an_bit)
+int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
 {
 	struct tcp_rule *rule;
 	struct stksess *ts;
 	struct stktable *t;
 	int partial;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -1180,7 +1180,7 @@
 					goto missing_data; /* key might appear later */
 
 				if (key && (ts = stktable_get_entry(t, key))) {
-					session_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
+					stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
 					stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
 					if (s->fe != s->be)
 						stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
@@ -1247,12 +1247,12 @@
  * response. It relies on buffers flags, and updates s->rep->analysers. The
  * function may be called for backend rules.
  */
-int tcp_inspect_response(struct session *s, struct channel *rep, int an_bit)
+int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
 {
 	struct tcp_rule *rule;
 	int partial;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		rep,
@@ -1358,7 +1358,7 @@
  * matches or if no more rule matches. It can only use rules which don't need
  * any data. This only works on connection-based client-facing stream interfaces.
  */
-int tcp_exec_req_rules(struct session *s)
+int tcp_exec_req_rules(struct stream *s)
 {
 	struct tcp_rule *rule;
 	struct stksess *ts;
@@ -1407,7 +1407,7 @@
 				key = stktable_fetch_key(t, s->be, s, &s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL);
 
 				if (key && (ts = stktable_get_entry(t, key)))
-					session_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
+					stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
 			}
 			else if (rule->action == TCP_ACT_EXPECT_PX) {
 				conn->flags |= CO_FL_ACCEPT_PROXY;
@@ -1962,7 +1962,7 @@
 
 /* fetch the connection's source IPv4/IPv6 address */
 static int
-smp_fetch_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
               const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *cli_conn = objt_conn(l4->si[0].end);
@@ -1989,7 +1989,7 @@
 
 /* set temp integer to the connection's source port */
 static int
-smp_fetch_sport(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *k, void *private)
 {
 	struct connection *cli_conn = objt_conn(l4->si[0].end);
@@ -2007,7 +2007,7 @@
 
 /* fetch the connection's destination IPv4/IPv6 address */
 static int
-smp_fetch_dst(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_dst(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
               const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *cli_conn = objt_conn(l4->si[0].end);
@@ -2036,7 +2036,7 @@
 
 /* set temp integer to the frontend connexion's destination port */
 static int
-smp_fetch_dport(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_dport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *cli_conn = objt_conn(l4->si[0].end);
diff --git a/src/proxy.c b/src/proxy.c
index a8cb443..df8bc1e 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -623,7 +623,7 @@
 
 /*
  * This is the proxy management task. It enables proxies when there are enough
- * free sessions, or stops them when the table is full. It is designed to be
+ * free streams, or stops them when the table is full. It is designed to be
  * called as a task which is woken up upon stopping or when rate limiting must
  * be enforced.
  */
@@ -658,7 +658,7 @@
 	/* If the proxy holds a stick table, we need to purge all unused
 	 * entries. These are all the ones in the table with ref_cnt == 0
 	 * and all the ones in the pool used to allocate new entries. Any
-	 * entry attached to an existing session waiting for a store will
+	 * entry attached to an existing stream waiting for a store will
 	 * be in neither list. Any entry being dumped will have ref_cnt > 0.
 	 * However we protect tables that are being synced to peers.
 	 */
@@ -918,13 +918,13 @@
 	}
 }
 
-/* Set current session's backend to <be>. Nothing is done if the
- * session already had a backend assigned, which is indicated by
+/* Set current stream's backend to <be>. Nothing is done if the
+ * stream already had a backend assigned, which is indicated by
  * s->flags & SN_BE_ASSIGNED.
  * All flags, stats and counters which need be updated are updated.
  * Returns 1 if done, 0 in case of internal error, eg: lack of resource.
  */
-int session_set_backend(struct session *s, struct proxy *be)
+int stream_set_backend(struct stream *s, struct proxy *be)
 {
 	if (s->flags & SN_BE_ASSIGNED)
 		return 1;
@@ -934,7 +934,7 @@
 		be->be_counters.conn_max = be->beconn;
 	proxy_inc_be_ctr(be);
 
-	/* assign new parameters to the session from the new backend */
+	/* assign new parameters to the stream from the new backend */
 	s->si[1].flags &= ~SI_FL_INDEP_STR;
 	if (be->options2 & PR_O2_INDEPSTR)
 		s->si[1].flags |= SI_FL_INDEP_STR;
diff --git a/src/queue.c b/src/queue.c
index 74fa659..14e4be6 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -16,7 +16,7 @@
 
 #include <proto/queue.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 
@@ -63,7 +63,7 @@
 
 /*
  * Manages a server's connection queue. This function will try to dequeue as
- * many pending sessions as possible, and wake them up.
+ * many pending streams as possible, and wake them up.
  */
 void process_srv_queue(struct server *s)
 {
@@ -76,15 +76,16 @@
 
 	maxconn = srv_dynamic_maxconn(s);
 	while (s->served < maxconn) {
-		struct session *sess = pendconn_get_next_sess(s, p);
-		if (sess == NULL)
+		struct stream *strm = pendconn_get_next_strm(s, p);
+
+		if (strm == NULL)
 			break;
-		task_wakeup(sess->task, TASK_WOKEN_RES);
+		task_wakeup(strm->task, TASK_WOKEN_RES);
 	}
 }
 
 /* Detaches the next pending connection from either a server or a proxy, and
- * returns its associated session. If no pending connection is found, NULL is
+ * returns its associated stream. If no pending connection is found, NULL is
  * returned. Note that neither <srv> nor <px> may be NULL.
  * Priority is given to the oldest request in the queue if both <srv> and <px>
  * have pending requests. This ensures that no request will be left unserved.
@@ -93,13 +94,13 @@
  * queue is still considered in this case, because if some connections remain
  * there, it means that some requests have been forced there after it was seen
  * down (eg: due to option persist).
- * The session is immediately marked as "assigned", and both its <srv> and
+ * The stream is immediately marked as "assigned", and both its <srv> and
  * <srv_conn> are set to <srv>,
  */
-struct session *pendconn_get_next_sess(struct server *srv, struct proxy *px)
+struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px)
 {
 	struct pendconn *ps, *pp;
-	struct session *sess;
+	struct stream *strm;
 	struct server *rsrv;
 
 	rsrv = srv->track;
@@ -114,30 +115,30 @@
 			return NULL;
 	} else {
 		/* pendconn exists in the proxy queue */
-		if (!ps || tv_islt(&pp->sess->logs.tv_request, &ps->sess->logs.tv_request))
+		if (!ps || tv_islt(&pp->strm->logs.tv_request, &ps->strm->logs.tv_request))
 			ps = pp;
 	}
-	sess = ps->sess;
+	strm = ps->strm;
 	pendconn_free(ps);
 
-	/* we want to note that the session has now been assigned a server */
-	sess->flags |= SN_ASSIGNED;
-	sess->target = &srv->obj_type;
-	session_add_srv_conn(sess, srv);
+	/* we want to note that the stream has now been assigned a server */
+	strm->flags |= SN_ASSIGNED;
+	strm->target = &srv->obj_type;
+	stream_add_srv_conn(strm, srv);
 	srv->served++;
 	if (px->lbprm.server_take_conn)
 		px->lbprm.server_take_conn(srv);
 
-	return sess;
+	return strm;
 }
 
-/* Adds the session <sess> to the pending connection list of server <sess>->srv
- * or to the one of <sess>->proxy if srv is NULL. All counters and back pointers
+/* Adds the stream <strm> to the pending connection list of server <strm>->srv
+ * or to the one of <strm>->proxy if srv is NULL. All counters and back pointers
  * are updated accordingly. Returns NULL if no memory is available, otherwise the
- * pendconn itself. If the session was already marked as served, its flag is
- * cleared. It is illegal to call this function with a non-NULL sess->srv_conn.
+ * pendconn itself. If the stream was already marked as served, its flag is
+ * cleared. It is illegal to call this function with a non-NULL strm->srv_conn.
  */
-struct pendconn *pendconn_add(struct session *sess)
+struct pendconn *pendconn_add(struct stream *strm)
 {
 	struct pendconn *p;
 	struct server *srv;
@@ -146,24 +147,24 @@
 	if (!p)
 		return NULL;
 
-	sess->pend_pos = p;
-	p->sess = sess;
-	p->srv = srv = objt_server(sess->target);
+	strm->pend_pos = p;
+	p->strm = strm;
+	p->srv = srv = objt_server(strm->target);
 
-	if (sess->flags & SN_ASSIGNED && srv) {
+	if (strm->flags & SN_ASSIGNED && srv) {
 		LIST_ADDQ(&srv->pendconns, &p->list);
 		srv->nbpend++;
-		sess->logs.srv_queue_size += srv->nbpend;
+		strm->logs.srv_queue_size += srv->nbpend;
 		if (srv->nbpend > srv->counters.nbpend_max)
 			srv->counters.nbpend_max = srv->nbpend;
 	} else {
-		LIST_ADDQ(&sess->be->pendconns, &p->list);
-		sess->be->nbpend++;
-		sess->logs.prx_queue_size += sess->be->nbpend;
-		if (sess->be->nbpend > sess->be->be_counters.nbpend_max)
-			sess->be->be_counters.nbpend_max = sess->be->nbpend;
+		LIST_ADDQ(&strm->be->pendconns, &p->list);
+		strm->be->nbpend++;
+		strm->logs.prx_queue_size += strm->be->nbpend;
+		if (strm->be->nbpend > strm->be->be_counters.nbpend_max)
+			strm->be->be_counters.nbpend_max = strm->be->nbpend;
 	}
-	sess->be->totpend++;
+	strm->be->totpend++;
 	return p;
 }
 
@@ -176,19 +177,19 @@
 	int xferred = 0;
 
 	list_for_each_entry_safe(pc, pc_bck, &s->pendconns, list) {
-		struct session *sess = pc->sess;
+		struct stream *strm = pc->strm;
 
-		if ((sess->be->options & (PR_O_REDISP|PR_O_PERSIST)) == PR_O_REDISP &&
-		    !(sess->flags & SN_FORCE_PRST)) {
+		if ((strm->be->options & (PR_O_REDISP|PR_O_PERSIST)) == PR_O_REDISP &&
+		    !(strm->flags & SN_FORCE_PRST)) {
 			/* The REDISP option was specified. We will ignore
 			 * cookie and force to balance or use the dispatcher.
 			 */
 
 			/* it's left to the dispatcher to choose a server */
-			sess->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
+			strm->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET);
 
 			pendconn_free(pc);
-			task_wakeup(sess->task, TASK_WOKEN_RES);
+			task_wakeup(strm->task, TASK_WOKEN_RES);
 			xferred++;
 		}
 	}
@@ -208,16 +209,16 @@
 		return 0;
 
 	for (xferred = 0; !s->maxconn || xferred < srv_dynamic_maxconn(s); xferred++) {
-		struct session *sess;
+		struct stream *strm;
 		struct pendconn *p;
 
 		p = pendconn_from_px(s->proxy);
 		if (!p)
 			break;
-		p->sess->target = &s->obj_type;
-		sess = p->sess;
+		p->strm->target = &s->obj_type;
+		strm = p->strm;
 		pendconn_free(p);
-		task_wakeup(sess->task, TASK_WOKEN_RES);
+		task_wakeup(strm->task, TASK_WOKEN_RES);
 	}
 	return xferred;
 }
@@ -225,17 +226,17 @@
 /*
  * Detaches pending connection <p>, decreases the pending count, and frees
  * the pending connection. The connection might have been queued to a specific
- * server as well as to the proxy. The session also gets marked unqueued.
+ * server as well as to the proxy. The stream also gets marked unqueued.
  */
 void pendconn_free(struct pendconn *p)
 {
 	LIST_DEL(&p->list);
-	p->sess->pend_pos = NULL;
+	p->strm->pend_pos = NULL;
 	if (p->srv)
 		p->srv->nbpend--;
 	else
-		p->sess->be->nbpend--;
-	p->sess->be->totpend--;
+		p->strm->be->nbpend--;
+	p->strm->be->totpend--;
 	pool_free2(pool2_pendconn, p);
 }
 
diff --git a/src/sample.c b/src/sample.c
index 3c464c4..c5f5b16 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -1022,7 +1022,7 @@
  *   smp      1        0     Present, may change (eg: request length)
  *   smp      1        1     Present, last known value (eg: request length)
  */
-struct sample *sample_process(struct proxy *px, struct session *l4, void *l7,
+struct sample *sample_process(struct proxy *px, struct stream *l4, void *l7,
                               unsigned int opt,
                               struct sample_expr *expr, struct sample *p)
 {
@@ -1331,7 +1331,7 @@
  *   smp      1        0     Not present yet, may appear later (eg: header)
  *   smp      1        1     never happens (either flag is cleared on output)
  */
-struct sample *sample_fetch_string(struct proxy *px, struct session *l4, void *l7,
+struct sample *sample_fetch_string(struct proxy *px, struct stream *l4, void *l7,
                                    unsigned int opt, struct sample_expr *expr)
 {
 	struct sample *smp = &temp_smp;
@@ -1360,7 +1360,7 @@
 /*    These functions set the data type on return.               */
 /*****************************************************************/
 
-static int sample_conv_bin2base64(struct session *session, const struct arg *arg_p,
+static int sample_conv_bin2base64(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	struct chunk *trash = get_trash_chunk();
@@ -1378,7 +1378,7 @@
 	return 1;
 }
 
-static int sample_conv_bin2hex(struct session *session, const struct arg *arg_p,
+static int sample_conv_bin2hex(struct stream *stream, const struct arg *arg_p,
                                struct sample *smp, void *private)
 {
 	struct chunk *trash = get_trash_chunk();
@@ -1398,7 +1398,7 @@
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_djb2(struct session *session, const struct arg *arg_p,
+static int sample_conv_djb2(struct stream *stream, const struct arg *arg_p,
                             struct sample *smp, void *private)
 {
 	smp->data.uint = hash_djb2(smp->data.str.str, smp->data.str.len);
@@ -1408,7 +1408,7 @@
 	return 1;
 }
 
-static int sample_conv_str2lower(struct session *session, const struct arg *arg_p,
+static int sample_conv_str2lower(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	int i;
@@ -1426,7 +1426,7 @@
 	return 1;
 }
 
-static int sample_conv_str2upper(struct session *session, const struct arg *arg_p,
+static int sample_conv_str2upper(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	int i;
@@ -1445,7 +1445,7 @@
 }
 
 /* takes the netmask in arg_p */
-static int sample_conv_ipmask(struct session *session, const struct arg *arg_p,
+static int sample_conv_ipmask(struct stream *stream, const struct arg *arg_p,
                               struct sample *smp, void *private)
 {
 	smp->data.ipv4.s_addr &= arg_p->data.ipv4.s_addr;
@@ -1457,7 +1457,7 @@
  * adds an optional offset found in args[1] and emits a string representing
  * the local time in the format specified in args[1] using strftime().
  */
-static int sample_conv_ltime(struct session *session, const struct arg *args,
+static int sample_conv_ltime(struct stream *stream, const struct arg *args,
                              struct sample *smp, void *private)
 {
 	struct chunk *temp;
@@ -1475,7 +1475,7 @@
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_sdbm(struct session *session, const struct arg *arg_p,
+static int sample_conv_sdbm(struct stream *stream, const struct arg *arg_p,
                             struct sample *smp, void *private)
 {
 	smp->data.uint = hash_sdbm(smp->data.str.str, smp->data.str.len);
@@ -1489,7 +1489,7 @@
  * adds an optional offset found in args[1] and emits a string representing
  * the UTC date in the format specified in args[1] using strftime().
  */
-static int sample_conv_utime(struct session *session, const struct arg *args,
+static int sample_conv_utime(struct stream *stream, const struct arg *args,
                              struct sample *smp, void *private)
 {
 	struct chunk *temp;
@@ -1507,7 +1507,7 @@
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_wt6(struct session *session, const struct arg *arg_p,
+static int sample_conv_wt6(struct stream *stream, const struct arg *arg_p,
                            struct sample *smp, void *private)
 {
 	smp->data.uint = hash_wt6(smp->data.str.str, smp->data.str.len);
@@ -1518,7 +1518,7 @@
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_crc32(struct session *session, const struct arg *arg_p,
+static int sample_conv_crc32(struct stream *stream, const struct arg *arg_p,
                              struct sample *smp, void *private)
 {
 	smp->data.uint = hash_crc32(smp->data.str.str, smp->data.str.len);
@@ -1599,7 +1599,7 @@
 	return 0;
 }
 
-static int sample_conv_json(struct session *session, const struct arg *arg_p,
+static int sample_conv_json(struct stream *stream, const struct arg *arg_p,
                             struct sample *smp, void *private)
 {
 	struct chunk *temp;
@@ -1714,7 +1714,7 @@
 /* This sample function is designed to extract some bytes from an input buffer.
  * First arg is the offset.
  * Optional second arg is the length to truncate */
-static int sample_conv_bytes(struct session *session, const struct arg *arg_p,
+static int sample_conv_bytes(struct stream *stream, const struct arg *arg_p,
                              struct sample *smp, void *private)
 {
 	if (smp->data.str.len <= arg_p[0].data.uint) {
@@ -1772,7 +1772,7 @@
  * First arg is the index of the field (start at 1)
  * Second arg is a char list of separators (type string)
  */
-static int sample_conv_field(struct session *session, const struct arg *arg_p,
+static int sample_conv_field(struct stream *stream, const struct arg *arg_p,
                              struct sample *smp, void *private)
 {
 	unsigned int field;
@@ -1824,7 +1824,7 @@
  * First arg is the index of the word (start at 1)
  * Second arg is a char list of words separators (type string)
  */
-static int sample_conv_word(struct session *session, const struct arg *arg_p,
+static int sample_conv_word(struct stream *stream, const struct arg *arg_p,
                             struct sample *smp, void *private)
 {
 	unsigned int word;
@@ -1919,7 +1919,7 @@
  * location until nothing matches anymore. First arg is the regex to apply to
  * the input string, second arg is the replacement expression.
  */
-static int sample_conv_regsub(struct session *session, const struct arg *arg_p,
+static int sample_conv_regsub(struct stream *stream, const struct arg *arg_p,
                               struct sample *smp, void *private)
 {
 	char *start, *end;
@@ -1992,7 +1992,7 @@
 /* Takes a UINT on input, applies a binary twos complement and returns the UINT
  * result.
  */
-static int sample_conv_binary_cpl(struct session *session, const struct arg *arg_p,
+static int sample_conv_binary_cpl(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	smp->data.uint = ~smp->data.uint;
@@ -2002,7 +2002,7 @@
 /* Takes a UINT on input, applies a binary "and" with the UINT in arg_p, and
  * returns the UINT result.
  */
-static int sample_conv_binary_and(struct session *session, const struct arg *arg_p,
+static int sample_conv_binary_and(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	smp->data.uint &= arg_p->data.uint;
@@ -2012,7 +2012,7 @@
 /* Takes a UINT on input, applies a binary "or" with the UINT in arg_p, and
  * returns the UINT result.
  */
-static int sample_conv_binary_or(struct session *session, const struct arg *arg_p,
+static int sample_conv_binary_or(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint |= arg_p->data.uint;
@@ -2022,7 +2022,7 @@
 /* Takes a UINT on input, applies a binary "xor" with the UINT in arg_p, and
  * returns the UINT result.
  */
-static int sample_conv_binary_xor(struct session *session, const struct arg *arg_p,
+static int sample_conv_binary_xor(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	smp->data.uint ^= arg_p->data.uint;
@@ -2032,7 +2032,7 @@
 /* Takes a UINT on input, applies an arithmetic "add" with the UINT in arg_p,
  * and returns the UINT result.
  */
-static int sample_conv_arith_add(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_add(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint += arg_p->data.uint;
@@ -2042,7 +2042,7 @@
 /* Takes a UINT on input, applies an arithmetic "sub" with the UINT in arg_p,
  * and returns the UINT result.
  */
-static int sample_conv_arith_sub(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_sub(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint -= arg_p->data.uint;
@@ -2052,7 +2052,7 @@
 /* Takes a UINT on input, applies an arithmetic "mul" with the UINT in arg_p,
  * and returns the UINT result.
  */
-static int sample_conv_arith_mul(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_mul(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint *= arg_p->data.uint;
@@ -2063,7 +2063,7 @@
  * and returns the UINT result. If arg_p makes the result overflow, then the
  * largest possible quantity is returned.
  */
-static int sample_conv_arith_div(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_div(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	if (arg_p->data.uint)
@@ -2077,7 +2077,7 @@
  * and returns the UINT result. If arg_p makes the result overflow, then zero
  * is returned.
  */
-static int sample_conv_arith_mod(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_mod(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	if (arg_p->data.uint)
@@ -2090,7 +2090,7 @@
 /* Takes an UINT on input, applies an arithmetic "neg" and returns the UINT
  * result.
  */
-static int sample_conv_arith_neg(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_neg(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint = -smp->data.uint;
@@ -2100,7 +2100,7 @@
 /* Takes a UINT on input, returns true is the value is non-null, otherwise
  * false. The output is a BOOL.
  */
-static int sample_conv_arith_bool(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_bool(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	smp->data.uint = !!smp->data.uint;
@@ -2111,7 +2111,7 @@
 /* Takes a UINT on input, returns false is the value is non-null, otherwise
  * truee. The output is a BOOL.
  */
-static int sample_conv_arith_not(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_not(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint = !smp->data.uint;
@@ -2122,7 +2122,7 @@
 /* Takes a UINT on input, returns true is the value is odd, otherwise false.
  * The output is a BOOL.
  */
-static int sample_conv_arith_odd(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_odd(struct stream *stream, const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
 	smp->data.uint = smp->data.uint & 1;
@@ -2133,7 +2133,7 @@
 /* Takes a UINT on input, returns true is the value is even, otherwise false.
  * The output is a BOOL.
  */
-static int sample_conv_arith_even(struct session *session, const struct arg *arg_p,
+static int sample_conv_arith_even(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	smp->data.uint = !(smp->data.uint & 1);
@@ -2147,7 +2147,7 @@
 
 /* force TRUE to be returned at the fetch level */
 static int
-smp_fetch_true(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_true(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_BOOL;
@@ -2157,7 +2157,7 @@
 
 /* force FALSE to be returned at the fetch level */
 static int
-smp_fetch_false(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_false(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                 const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_BOOL;
@@ -2167,7 +2167,7 @@
 
 /* retrieve environment variable $1 as a string */
 static int
-smp_fetch_env(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_env(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
               const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	char *env;
@@ -2190,7 +2190,7 @@
  * of args[0] seconds.
  */
 static int
-smp_fetch_date(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_date(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->data.uint = date.tv_sec;
@@ -2206,7 +2206,7 @@
 
 /* returns the number of processes */
 static int
-smp_fetch_nbproc(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_nbproc(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_UINT;
@@ -2216,7 +2216,7 @@
 
 /* returns the number of the current process (between 1 and nbproc */
 static int
-smp_fetch_proc(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_proc(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_UINT;
@@ -2228,7 +2228,7 @@
  * range specified in argument.
  */
 static int
-smp_fetch_rand(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_rand(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->data.uint = random();
@@ -2244,7 +2244,7 @@
 
 /* returns true if the current process is stopping */
 static int
-smp_fetch_stopping(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+smp_fetch_stopping(struct proxy *px, struct stream *s, void *l7, unsigned int opt,
                    const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->type = SMP_T_BOOL;
diff --git a/src/server.c b/src/server.c
index edd7670..aee08b0 100644
--- a/src/server.c
+++ b/src/server.c
@@ -27,7 +27,7 @@
 #include <proto/queue.h>
 #include <proto/raw_sock.h>
 #include <proto/server.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/task.h>
 
 
@@ -166,26 +166,26 @@
  * code in <why>, which must be one of SN_ERR_* indicating the reason for the
  * shutdown.
  */
-void srv_shutdown_sessions(struct server *srv, int why)
+void srv_shutdown_streams(struct server *srv, int why)
 {
-	struct session *session, *session_bck;
+	struct stream *stream, *stream_bck;
 
-	list_for_each_entry_safe(session, session_bck, &srv->actconns, by_srv)
-		if (session->srv_conn == srv)
-			session_shutdown(session, why);
+	list_for_each_entry_safe(stream, stream_bck, &srv->actconns, by_srv)
+		if (stream->srv_conn == srv)
+			stream_shutdown(stream, why);
 }
 
 /* Shutdown all connections of all backup servers of a proxy. The caller must
  * pass a termination code in <why>, which must be one of SN_ERR_* indicating
  * the reason for the shutdown.
  */
-void srv_shutdown_backup_sessions(struct proxy *px, int why)
+void srv_shutdown_backup_streams(struct proxy *px, int why)
 {
 	struct server *srv;
 
 	for (srv = px->srv; srv != NULL; srv = srv->next)
 		if (srv->flags & SRV_F_BACKUP)
-			srv_shutdown_sessions(srv, why);
+			srv_shutdown_streams(srv, why);
 }
 
 /* Appends some information to a message string related to a server going UP or
@@ -193,7 +193,7 @@
  * one, a "via" information will be provided to know where the status came from.
  * If <reason> is non-null, the entire string will be appended after a comma and
  * a space (eg: to report some information from the check that changed the state).
- * If <xferred> is non-negative, some information about requeued sessions are
+ * If <xferred> is non-negative, some information about requeued streams are
  * provided.
  */
 void srv_append_status(struct chunk *msg, struct server *s, const char *reason, int xferred, int forced)
@@ -221,7 +221,7 @@
 
 /* Marks server <s> down, regardless of its checks' statuses, notifies by all
  * available means, recounts the remaining servers on the proxy and transfers
- * queued sessions whenever possible to other servers. It automatically
+ * queued streams whenever possible to other servers. It automatically
  * recomputes the number of servers, but not the map. Maintenance servers are
  * ignored. It reports <reason> if non-null as the reason for going down. Note
  * that it makes use of the trash to build the log strings, so <reason> must
@@ -244,9 +244,9 @@
 		s->proxy->lbprm.set_server_status_down(s);
 
 	if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
-		srv_shutdown_sessions(s, SN_ERR_DOWN);
+		srv_shutdown_streams(s, SN_ERR_DOWN);
 
-	/* we might have sessions queued on this server and waiting for
+	/* we might have streams queued on this server and waiting for
 	 * a connection. Those which are redispatchable will be queued
 	 * to another server or to the proxy itself.
 	 */
@@ -313,12 +313,12 @@
 
 	/* If the server is set with "on-marked-up shutdown-backup-sessions",
 	 * and it's not a backup server and its effective weight is > 0,
-	 * then it can accept new connections, so we shut down all sessions
+	 * then it can accept new connections, so we shut down all streams
 	 * on all backup servers.
 	 */
 	if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
 	    !(s->flags & SRV_F_BACKUP) && s->eweight)
-		srv_shutdown_backup_sessions(s->proxy, SN_ERR_UP);
+		srv_shutdown_backup_streams(s->proxy, SN_ERR_UP);
 
 	/* check if we can handle some connections queued at the proxy. We
 	 * will take as many as we can handle.
@@ -361,7 +361,7 @@
 	if (s->proxy->lbprm.set_server_status_down)
 		s->proxy->lbprm.set_server_status_down(s);
 
-	/* we might have sessions queued on this server and waiting for
+	/* we might have streams queued on this server and waiting for
 	 * a connection. Those which are redispatchable will be queued
 	 * to another server or to the proxy itself.
 	 */
@@ -438,9 +438,9 @@
 				s->proxy->lbprm.set_server_status_down(s);
 
 			if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
-				srv_shutdown_sessions(s, SN_ERR_DOWN);
+				srv_shutdown_streams(s, SN_ERR_DOWN);
 
-			/* we might have sessions queued on this server and waiting for
+			/* we might have streams queued on this server and waiting for
 			 * a connection. Those which are redispatchable will be queued
 			 * to another server or to the proxy itself.
 			 */
@@ -471,7 +471,7 @@
 		if (s->proxy->lbprm.set_server_status_down)
 			s->proxy->lbprm.set_server_status_down(s);
 
-		/* we might have sessions queued on this server and waiting for
+		/* we might have streams queued on this server and waiting for
 		 * a connection. Those which are redispatchable will be queued
 		 * to another server or to the proxy itself.
 		 */
@@ -595,12 +595,12 @@
 
 			/* If the server is set with "on-marked-up shutdown-backup-sessions",
 			 * and it's not a backup server and its effective weight is > 0,
-			 * then it can accept new connections, so we shut down all sessions
+			 * then it can accept new connections, so we shut down all streams
 			 * on all backup servers.
 			 */
 			if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) &&
 			    !(s->flags & SRV_F_BACKUP) && s->eweight)
-				srv_shutdown_backup_sessions(s->proxy, SN_ERR_UP);
+				srv_shutdown_backup_streams(s->proxy, SN_ERR_UP);
 
 			/* check if we can handle some connections queued at the proxy. We
 			 * will take as many as we can handle.
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 77c4490..f695309 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -3083,7 +3083,7 @@
 
 /* boolean, returns true if client cert was present */
 static int
-smp_fetch_ssl_fc_has_crt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                          const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
@@ -3112,7 +3112,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_der(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_der(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3160,7 +3160,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_serial(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_serial(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3208,7 +3208,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_sha1(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3256,7 +3256,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_notafter(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_notafter(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3303,7 +3303,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_i_dn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_i_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3366,7 +3366,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_notbefore(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_notbefore(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3413,7 +3413,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_s_dn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_s_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3473,7 +3473,7 @@
 
 /* integer, returns true if current session use a client certificate */
 static int
-smp_fetch_ssl_c_used(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_c_used(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	X509 *crt;
@@ -3507,7 +3507,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_version(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_version(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3547,7 +3547,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3599,7 +3599,7 @@
  * should be use.
  */
 static int
-smp_fetch_ssl_x_key_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int cert_peer = (kw[4] == 'c') ? 1 : 0;
@@ -3650,7 +3650,7 @@
  * char is 'b'.
  */
 static int
-smp_fetch_ssl_fc(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                  const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int back_conn = (kw[4] == 'b') ? 1 : 0;
@@ -3663,7 +3663,7 @@
 
 /* boolean, returns true if client present a SNI */
 static int
-smp_fetch_ssl_fc_has_sni(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                          const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
@@ -3684,7 +3684,7 @@
  * char is 'b'.
  */
 static int
-smp_fetch_ssl_fc_cipher(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                         const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int back_conn = (kw[4] == 'b') ? 1 : 0;
@@ -3716,7 +3716,7 @@
  * char is 'b'.
  */
 static int
-smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int back_conn = (kw[4] == 'b') ? 1 : 0;
@@ -3744,7 +3744,7 @@
  * char is 'b'.
  */
 static int
-smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int back_conn = (kw[4] == 'b') ? 1 : 0;
@@ -3770,7 +3770,7 @@
 
 #ifdef OPENSSL_NPN_NEGOTIATED
 static int
-smp_fetch_ssl_fc_npn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
@@ -3798,7 +3798,7 @@
 
 #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
 static int
-smp_fetch_ssl_fc_alpn(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
@@ -3829,7 +3829,7 @@
  * char is 'b'.
  */
 static int
-smp_fetch_ssl_fc_protocol(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                           const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	int back_conn = (kw[4] == 'b') ? 1 : 0;
@@ -3855,12 +3855,12 @@
 	return 1;
 }
 
-/* binary, returns the SSL session id if front conn. transport layer is SSL.
+/* binary, returns the SSL stream id if front conn. transport layer is SSL.
  * This function is also usable on backend conn if the fetch keyword 5th
  * char is 'b'.
  */
 static int
-smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                             const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 #if OPENSSL_VERSION_NUMBER > 0x0090800fL
@@ -3893,7 +3893,7 @@
 }
 
 static int
-smp_fetch_ssl_fc_sni(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                      const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
@@ -3921,7 +3921,7 @@
 }
 
 static int
-smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                           const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 #if OPENSSL_VERSION_NUMBER > 0x0090800fL
@@ -3965,7 +3965,7 @@
 
 /* integer, returns the first verify error in CA chain of client certificate chain. */
 static int
-smp_fetch_ssl_c_ca_err(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
@@ -3991,7 +3991,7 @@
 
 /* integer, returns the depth of the first verify error in CA chain of client certificate chain. */
 static int
-smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                              const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
@@ -4017,7 +4017,7 @@
 
 /* integer, returns the first verify error on client certificate */
 static int
-smp_fetch_ssl_c_err(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_c_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
@@ -4043,7 +4043,7 @@
 
 /* integer, returns the verify result on client cert */
 static int
-smp_fetch_ssl_c_verify(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_ssl_c_verify(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn;
diff --git a/src/stick_table.c b/src/stick_table.c
index d128cff..f0f7808 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -25,7 +25,7 @@
 #include <proto/arg.h>
 #include <proto/proxy.h>
 #include <proto/sample.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/stick_table.h>
 #include <proto/task.h>
 #include <proto/peers.h>
@@ -680,7 +680,7 @@
  *   smp      1        0     not possible
  *   smp      1        1     Present, last known value (eg: request length)
  */
-struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct session *l4, void *l7,
+struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct stream *l4, void *l7,
                                         unsigned int opt, struct sample_expr *expr, struct sample *smp)
 {
 	if (smp)
@@ -809,7 +809,7 @@
  * the table's type. This is a double conversion, but in the future we might
  * support automatic input types to perform the cast on the fly.
  */
-static int sample_conv_in_table(struct session *session, const struct arg *arg_p,
+static int sample_conv_in_table(struct stream *stream, const struct arg *arg_p,
                                 struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -836,7 +836,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_bytes_in_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_bytes_in_rate(struct stream *stream, const struct arg *arg_p,
                                            struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -873,7 +873,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_conn_cnt(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_conn_cnt(struct stream *stream, const struct arg *arg_p,
                                       struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -909,7 +909,7 @@
  * can be easily performed. If the inspected parameter is not stored in the
  * table, <not found> is returned.
  */
-static int sample_conv_table_conn_cur(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_conn_cur(struct stream *stream, const struct arg *arg_p,
                                       struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -945,7 +945,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_conn_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_conn_rate(struct stream *stream, const struct arg *arg_p,
                                        struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -982,7 +982,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_bytes_out_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_bytes_out_rate(struct stream *stream, const struct arg *arg_p,
                                             struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1019,7 +1019,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_gpc0(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_gpc0(struct stream *stream, const struct arg *arg_p,
                                   struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1055,7 +1055,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_gpc0_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_gpc0_rate(struct stream *stream, const struct arg *arg_p,
                                        struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1092,7 +1092,7 @@
  * comparisons can be easily performed. If the inspected parameter is not stored
  * in the table, <not found> is returned.
  */
-static int sample_conv_table_http_err_cnt(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_http_err_cnt(struct stream *stream, const struct arg *arg_p,
                                           struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1128,7 +1128,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_http_err_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_http_err_rate(struct stream *stream, const struct arg *arg_p,
                                            struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1165,7 +1165,7 @@
  * can be easily performed. If the inspected parameter is not stored in the
  * table, <not found> is returned.
  */
-static int sample_conv_table_http_req_cnt(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_http_req_cnt(struct stream *stream, const struct arg *arg_p,
                                           struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1201,7 +1201,7 @@
  * performed. If the inspected parameter is not stored in the table, <not found>
  * is returned.
  */
-static int sample_conv_table_http_req_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_http_req_rate(struct stream *stream, const struct arg *arg_p,
                                            struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1238,7 +1238,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_kbytes_in(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_kbytes_in(struct stream *stream, const struct arg *arg_p,
                                        struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1274,7 +1274,7 @@
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_kbytes_out(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_kbytes_out(struct stream *stream, const struct arg *arg_p,
                                         struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1310,7 +1310,7 @@
  * easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_server_id(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_server_id(struct stream *stream, const struct arg *arg_p,
                                        struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1346,7 +1346,7 @@
  * can be easily performed. If the inspected parameter is not stored in the
  * table, <not found> is returned.
  */
-static int sample_conv_table_sess_cnt(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_sess_cnt(struct stream *stream, const struct arg *arg_p,
                                       struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1382,7 +1382,7 @@
  * performed. If the inspected parameter is not stored in the table, <not found>
  * is returned.
  */
-static int sample_conv_table_sess_rate(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_sess_rate(struct stream *stream, const struct arg *arg_p,
                                        struct sample *smp, void *private)
 {
 	struct stktable *t;
@@ -1419,7 +1419,7 @@
  * comparisons can be easily performed. If the inspected parameter is not
  * stored in the table, <not found> is returned.
  */
-static int sample_conv_table_trackers(struct session *session, const struct arg *arg_p,
+static int sample_conv_table_trackers(struct stream *stream, const struct arg *arg_p,
                                       struct sample *smp, void *private)
 {
 	struct stktable *t;
diff --git a/src/session.c b/src/stream.c
similarity index 91%
rename from src/session.c
rename to src/stream.c
index 677d3a1..36ef2ca 100644
--- a/src/session.c
+++ b/src/stream.c
@@ -1,5 +1,5 @@
 /*
- * Session management functions.
+ * Stream management functions.
  *
  * Copyright 2000-2012 Willy Tarreau <w@1wt.eu>
  *
@@ -37,7 +37,7 @@
 #include <proto/listener.h>
 #include <proto/log.h>
 #include <proto/raw_sock.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/pipe.h>
 #include <proto/proto_http.h>
 #include <proto/proto_tcp.h>
@@ -49,36 +49,36 @@
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 
-struct pool_head *pool2_session;
-struct list sessions;
+struct pool_head *pool2_stream;
+struct list streams;
 
-/* list of sessions waiting for at least one buffer */
+/* list of streams waiting for at least one buffer */
 struct list buffer_wq = LIST_HEAD_INIT(buffer_wq);
 
-static int conn_session_complete(struct connection *conn);
-static int conn_session_update(struct connection *conn);
+static int conn_stream_complete(struct connection *conn);
+static int conn_stream_update(struct connection *conn);
 static struct task *expire_mini_session(struct task *t);
-int session_complete(struct session *s);
+int stream_complete(struct stream *s);
 
-/* data layer callbacks for an embryonic session */
+/* data layer callbacks for an embryonic stream */
 struct data_cb sess_conn_cb = {
 	.recv = NULL,
 	.send = NULL,
-	.wake = conn_session_update,
-	.init = conn_session_complete,
+	.wake = conn_stream_update,
+	.init = conn_stream_complete,
 };
 
 /* This function is called from the protocol layer accept() in order to
- * instanciate a new embryonic session on behalf of a given listener and
+ * instanciate a new embryonic stream on behalf of a given listener and
  * frontend. It returns a positive value upon success, 0 if the connection
  * can be ignored, or a negative value upon critical failure. The accepted
  * file descriptor is closed if we return <= 0.
  */
-int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
+int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
 {
 	struct connection *cli_conn;
 	struct proxy *p = l->frontend;
-	struct session *s;
+	struct stream *s;
 	struct task *t;
 	int ret;
 
@@ -96,10 +96,10 @@
 	cli_conn->target = &l->obj_type;
 	cli_conn->proxy_netns = l->netns;
 
-	if (unlikely((s = pool_alloc2(pool2_session)) == NULL))
+	if (unlikely((s = pool_alloc2(pool2_stream)) == NULL))
 		goto out_free_conn;
 
-	/* minimum session initialization required for an embryonic session is
+	/* minimum stream initialization required for an embryonic stream is
 	 * fairly low. We need very little to execute L4 ACLs, then we need a
 	 * task to make the client-side connection live on its own.
 	 *  - flags
@@ -123,9 +123,9 @@
 	s->si[1].flags = SI_FL_ISBACK;
 
 	/* On a mini-session, the connection is directly attached to the
-	 * session's target so that we don't need to initialize the stream
+	 * stream's target so that we don't need to initialize the stream
 	 * interfaces. Another benefit is that it's easy to detect a mini-
-	 * session in dumps using this : it's the only one which has a
+	 * stream in dumps using this : it's the only one which has a
 	 * connection in s->target.
 	 */
 	s->target = &cli_conn->obj_type;
@@ -134,7 +134,7 @@
 	s->logs.tv_accept = now;  /* corrected date for internal use */
 	s->uniq_id = global.req_count++;
 	p->feconn++;
-	/* This session was accepted, count it now */
+	/* This stream was accepted, count it now */
 	if (p->feconn > p->fe_counters.conn_max)
 		p->fe_counters.conn_max = p->feconn;
 
@@ -212,7 +212,7 @@
 
 	/* OK, now either we have a pending handshake to execute with and
 	 * then we must return to the I/O layer, or we can proceed with the
-	 * end of the session initialization. In case of handshake, we also
+	 * end of the stream initialization. In case of handshake, we also
 	 * set the I/O timeout to the frontend's client timeout.
 	 */
 
@@ -224,9 +224,9 @@
 		return 1;
 	}
 
-	/* OK let's complete session initialization since there is no handshake */
+	/* OK let's complete stream initialization since there is no handshake */
 	cli_conn->flags |= CO_FL_CONNECTED;
-	ret = session_complete(s);
+	ret = stream_complete(s);
 	if (ret > 0)
 		return ret;
 
@@ -235,8 +235,8 @@
 	task_free(t);
  out_free_session:
 	p->feconn--;
-	session_store_counters(s);
-	pool_free2(pool2_session, s);
+	stream_store_counters(s);
+	pool_free2(pool2_stream, s);
  out_free_conn:
 	cli_conn->flags &= ~CO_FL_XPRT_TRACKED;
 	conn_xprt_close(cli_conn);
@@ -258,11 +258,11 @@
 }
 
 
-/* prepare the trash with a log prefix for session <s>. It only works with
- * embryonic sessions based on a real connection. This function requires that
+/* prepare the trash with a log prefix for stream <s>. It only works with
+ * embryonic streams based on a real connection. This function requires that
  * at s->target still points to the incoming connection.
  */
-static void prepare_mini_sess_log_prefix(struct session *s)
+static void prepare_mini_sess_log_prefix(struct stream *s)
 {
 	struct tm tm;
 	char pn[INET6_ADDRSTRLEN];
@@ -287,12 +287,12 @@
 		chunk_appendf(&trash, "] %s/%d", s->fe->id, s->listener->luid);
 }
 
-/* This function kills an existing embryonic session. It stops the connection's
+/* This function kills an existing embryonic stream. It stops the connection's
  * transport layer, releases assigned resources, resumes the listener if it was
  * disabled and finally kills the file descriptor. This function requires that
  * at s->target still points to the incoming connection.
  */
-static void kill_mini_session(struct session *s)
+static void kill_mini_session(struct stream *s)
 {
 	int level = LOG_INFO;
 	struct connection *conn = __objt_conn(s->target);
@@ -332,7 +332,7 @@
 	conn_free(conn);
 
 	s->fe->feconn--;
-	session_store_counters(s);
+	stream_store_counters(s);
 
 	if (!(s->listener->options & LI_O_UNLIMITED))
 		actconn--;
@@ -351,17 +351,17 @@
 
 	task_delete(s->task);
 	task_free(s->task);
-	pool_free2(pool2_session, s);
+	pool_free2(pool2_stream, s);
 }
 
-/* Finish initializing a session from a connection, or kills it if the
+/* Finish initializing a stream from a connection, or kills it if the
  * connection shows and error. Returns <0 if the connection was killed.
  */
-static int conn_session_complete(struct connection *conn)
+static int conn_stream_complete(struct connection *conn)
 {
-	struct session *s = conn->owner;
+	struct stream *s = conn->owner;
 
-	if (!(conn->flags & CO_FL_ERROR) && (session_complete(s) > 0)) {
+	if (!(conn->flags & CO_FL_ERROR) && (stream_complete(s) > 0)) {
 		conn->flags &= ~CO_FL_INIT_DATA;
 		return 0;
 	}
@@ -371,10 +371,10 @@
 	return -1;
 }
 
-/* Update an embryonic session status. The connection is killed in case of
+/* Update an embryonic stream status. The connection is killed in case of
  * error, and <0 will be returned. Otherwise it does nothing.
  */
-static int conn_session_update(struct connection *conn)
+static int conn_stream_update(struct connection *conn)
 {
 	if (conn->flags & CO_FL_ERROR) {
 		kill_mini_session(conn->owner);
@@ -383,12 +383,12 @@
 	return 0;
 }
 
-/* Manages embryonic sessions timeout. It is only called when the timeout
+/* Manages embryonic streams timeout. It is only called when the timeout
  * strikes and performs the required cleanup.
  */
 static struct task *expire_mini_session(struct task *t)
 {
-	struct session *s = t->context;
+	struct stream *s = t->context;
 
 	if (!(t->state & TASK_WOKEN_TIMER))
 		return t;
@@ -398,15 +398,15 @@
 }
 
 /* This function is called from the I/O handler which detects the end of
- * handshake, in order to complete initialization of a valid session. It must
- * be called with an embryonic session. It returns a positive value upon
+ * handshake, in order to complete initialization of a valid stream. It must
+ * be called with an embryonic stream. It returns a positive value upon
  * success, 0 if the connection can be ignored, or a negative value upon
  * critical failure. The accepted file descriptor is closed if we return <= 0.
  * The client-side end point is assumed to be a connection, whose pointer is
  * taken from s->target which is assumed to be valid. If the function fails,
  * it restores s->target.
  */
-int session_complete(struct session *s)
+int stream_complete(struct stream *s)
 {
 	struct listener *l = s->listener;
 	struct proxy *p = s->fe;
@@ -418,8 +418,8 @@
 
 	ret = -1; /* assume unrecoverable error by default */
 
-	/* OK, we're keeping the session, so let's properly initialize the session */
-	LIST_ADDQ(&sessions, &s->list);
+	/* OK, we're keeping the stream, so let's properly initialize the stream */
+	LIST_ADDQ(&streams, &s->list);
 	LIST_INIT(&s->back_refs);
 	LIST_INIT(&s->buffer_wait);
 
@@ -430,7 +430,7 @@
 	t->context = s;
 	t->expire = TICK_ETERNITY;
 
-	/* Note: initially, the session's backend points to the frontend.
+	/* Note: initially, the stream's backend points to the frontend.
 	 * This changes later when switching rules are executed or
 	 * when the default backend is assigned.
 	 */
@@ -438,7 +438,7 @@
 	s->comp_algo = NULL;
 	s->req.buf = s->res.buf = NULL;
 
-	/* Let's count a session now */
+	/* Let's count a stream now */
 	proxy_inc_fe_sess_ctr(l, p);
 
 	for (i = 0; i < MAX_SESS_STKCTR; i++) {
@@ -480,7 +480,7 @@
 	if (likely(s->fe->options2 & PR_O2_INDEPSTR))
 		s->si[1].flags |= SI_FL_INDEP_STR;
 
-	session_init_srv_conn(s);
+	stream_init_srv_conn(s);
 	s->target = l->default_target; /* used by peers and CLI */
 	s->pend_pos = NULL;
 
@@ -516,7 +516,7 @@
 
 	txn = &s->txn;
 	/* Those variables will be checked and freed if non-NULL in
-	 * session.c:session_free(). It is important that they are
+	 * stream.c:stream_free(). It is important that they are
 	 * properly initialized.
 	 */
 	txn->sessid = NULL;
@@ -572,9 +572,9 @@
 }
 
 /*
- * frees  the context associated to a session. It must have been removed first.
+ * frees  the context associated to a stream. It must have been removed first.
  */
-static void session_free(struct session *s)
+static void stream_free(struct stream *s)
 {
 	struct http_txn *txn = &s->txn;
 	struct proxy *fe = s->fe;
@@ -595,7 +595,7 @@
 	}
 
 	if (unlikely(s->srv_conn)) {
-		/* the session still has a reserved slot on a server, but
+		/* the stream still has a reserved slot on a server, but
 		 * it should normally be only the same as the one above,
 		 * so this should not happen in fact.
 		 */
@@ -617,7 +617,7 @@
 	b_drop(&s->req.buf);
 	b_drop(&s->res.buf);
 	if (!LIST_ISEMPTY(&buffer_wq))
-		session_offer_buffers();
+		stream_offer_buffers();
 
 	hlua_ctx_destroy(&s->hlua);
 	http_end_txn(s);
@@ -639,22 +639,22 @@
 		pool_free2(fe->req_cap_pool, txn->req.cap);
 	}
 
-	session_store_counters(s);
+	stream_store_counters(s);
 
 	list_for_each_entry_safe(bref, back, &s->back_refs, users) {
 		/* we have to unlink all watchers. We must not relink them if
-		 * this session was the last one in the list.
+		 * this stream was the last one in the list.
 		 */
 		LIST_DEL(&bref->users);
 		LIST_INIT(&bref->users);
-		if (s->list.n != &sessions)
-			LIST_ADDQ(&LIST_ELEM(s->list.n, struct session *, list)->back_refs, &bref->users);
+		if (s->list.n != &streams)
+			LIST_ADDQ(&LIST_ELEM(s->list.n, struct stream *, list)->back_refs, &bref->users);
 		bref->ref = s->list.n;
 	}
 	LIST_DEL(&s->list);
 	si_release_endpoint(&s->si[1]);
 	si_release_endpoint(&s->si[0]);
-	pool_free2(pool2_session, s);
+	pool_free2(pool2_stream, s);
 
 	/* We may want to free the maximum amount of pools if the proxy is stopping */
 	if (fe && unlikely(fe->state == PR_STSTOPPED)) {
@@ -662,7 +662,7 @@
 		pool_flush2(pool2_hdr_idx);
 		pool_flush2(pool2_requri);
 		pool_flush2(pool2_capture);
-		pool_flush2(pool2_session);
+		pool_flush2(pool2_stream);
 		pool_flush2(pool2_connection);
 		pool_flush2(pool2_pendconn);
 		pool_flush2(fe->req_cap_pool);
@@ -678,9 +678,9 @@
  * buffers are properly allocated. Returns 0 in case of failure, non-zero
  * otherwise.
  */
-int session_alloc_recv_buffer(struct channel *chn)
+int stream_alloc_recv_buffer(struct channel *chn)
 {
-	struct session *s;
+	struct stream *s;
 	struct buffer *b;
 	int margin = 0;
 
@@ -698,8 +698,8 @@
 	return 0;
 }
 
-/* Allocates a work buffer for session <s>. It is meant to be called inside
- * process_session(). It will only allocate the side needed for the function
+/* Allocates a work buffer for stream <s>. It is meant to be called inside
+ * process_stream(). It will only allocate the side needed for the function
  * to work fine. For a regular connection, only the response is needed so that
  * an error message may be built and returned. In case where the initiator is
  * an applet (eg: peers), then we need to allocate the request buffer for the
@@ -709,7 +709,7 @@
  * a response may always flow and will never block a server from releasing a
  * connection. Returns 0 in case of failure, non-zero otherwise.
  */
-int session_alloc_work_buffer(struct session *s)
+int stream_alloc_work_buffer(struct stream *s)
 {
 	int margin;
 	struct buffer **buf;
@@ -737,11 +737,11 @@
 
 /* releases unused buffers after processing. Typically used at the end of the
  * update() functions. It will try to wake up as many tasks as the number of
- * buffers that it releases. In practice, most often sessions are blocked on
+ * buffers that it releases. In practice, most often streams are blocked on
  * a single buffer, so it makes sense to try to wake two up when two buffers
  * are released at once.
  */
-void session_release_buffers(struct session *s)
+void stream_release_buffers(struct stream *s)
 {
 	if (s->req.buf->size && buffer_empty(s->req.buf))
 		b_free(&s->req.buf);
@@ -753,16 +753,16 @@
 	 * someone waiting, we can wake up a waiter and offer them.
 	 */
 	if (!LIST_ISEMPTY(&buffer_wq))
-		session_offer_buffers();
+		stream_offer_buffers();
 }
 
-/* Runs across the list of pending sessions waiting for a buffer and wakes one
+/* Runs across the list of pending streams waiting for a buffer and wakes one
  * up if buffers are available. Will stop when the run queue reaches <rqlimit>.
- * Should not be called directly, use session_offer_buffers() instead.
+ * Should not be called directly, use stream_offer_buffers() instead.
  */
-void __session_offer_buffers(int rqlimit)
+void __stream_offer_buffers(int rqlimit)
 {
-	struct session *sess, *bak;
+	struct stream *sess, *bak;
 
 	list_for_each_entry_safe(sess, bak, &buffer_wq, buffer_wait) {
 		if (rqlimit <= run_queue)
@@ -778,14 +778,14 @@
 }
 
 /* perform minimal intializations, report 0 in case of error, 1 if OK. */
-int init_session()
+int init_stream()
 {
-	LIST_INIT(&sessions);
-	pool2_session = create_pool("session", sizeof(struct session), MEM_F_SHARED);
-	return pool2_session != NULL;
+	LIST_INIT(&streams);
+	pool2_stream = create_pool("stream", sizeof(struct stream), MEM_F_SHARED);
+	return pool2_stream != NULL;
 }
 
-void session_process_counters(struct session *s)
+void stream_process_counters(struct stream *s)
 {
 	unsigned long long bytes;
 	void *ptr;
@@ -861,9 +861,9 @@
  * We must check for establishment, error and abort. Possible output states
  * are SI_ST_EST (established), SI_ST_CER (error), SI_ST_DIS (abort), and
  * SI_ST_CON (no change). The function returns 0 if it switches to SI_ST_CER,
- * otherwise 1. This only works with connection-based sessions.
+ * otherwise 1. This only works with connection-based streams.
  */
-static int sess_update_st_con_tcp(struct session *s)
+static int sess_update_st_con_tcp(struct stream *s)
 {
 	struct stream_interface *si = &s->si[1];
 	struct channel *req = &s->req;
@@ -935,11 +935,11 @@
  * and SI_ST_REQ when an immediate redispatch is wanted. The buffers are
  * marked as in error state. It returns 0.
  */
-static int sess_update_st_cer(struct session *s)
+static int sess_update_st_cer(struct stream *s)
 {
 	struct stream_interface *si = &s->si[1];
 
-	/* we probably have to release last session from the server */
+	/* we probably have to release last stream from the server */
 	if (objt_server(s->target)) {
 		health_adjust(objt_server(s->target), HANA_STATUS_L4_ERR);
 
@@ -976,7 +976,7 @@
 
 	/* If the "redispatch" option is set on the backend, we are allowed to
 	 * retry on another server for the last retry. In order to achieve this,
-	 * we must mark the session unassigned, and eventually clear the DIRECT
+	 * we must mark the stream unassigned, and eventually clear the DIRECT
 	 * bit to ignore any persistence cookie. We won't count a retry nor a
 	 * redispatch yet, because this will depend on what server is selected.
 	 * If the connection is not persistent, the balancing algorithm is not
@@ -1034,7 +1034,7 @@
  * SI_ST_EST state. It must only be called after switching from SI_ST_CON (or
  * SI_ST_INI) to SI_ST_EST, but only when a ->proto is defined.
  */
-static void sess_establish(struct session *s)
+static void sess_establish(struct stream *s)
 {
 	struct stream_interface *si = &s->si[1];
 	struct channel *req = &s->req;
@@ -1080,7 +1080,7 @@
  * and SI_ST_EST. Flags must have previously been updated for timeouts and other
  * conditions.
  */
-static void sess_update_stream_int(struct session *s)
+static void sess_update_stream_int(struct stream *s)
 {
 	struct server *srv = objt_server(s->target);
 	struct stream_interface *si = &s->si[1];
@@ -1126,7 +1126,7 @@
 				srv->counters.failed_conns++;
 			s->be->be_counters.failed_conns++;
 
-			/* release other sessions waiting for this server */
+			/* release other streams waiting for this server */
 			sess_change_server(s, NULL);
 			if (may_dequeue_tasks(srv, s->be))
 				process_srv_queue(srv);
@@ -1138,7 +1138,7 @@
 
 			s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
 
-			/* no session was ever accounted for this server */
+			/* no stream was ever accounted for this server */
 			si->state = SI_ST_CLO;
 			if (s->srv_error)
 				s->srv_error(s, si);
@@ -1232,7 +1232,7 @@
 
 		si->exp = TICK_ETERNITY;
 
-		/* we keep trying on the same server as long as the session is
+		/* we keep trying on the same server as long as the stream is
 		 * marked "assigned".
 		 * FIXME: Should we force a redispatch attempt when the server is down ?
 		 */
@@ -1244,11 +1244,11 @@
 	}
 }
 
-/* Set correct session termination flags in case no analyser has done it. It
+/* Set correct stream termination flags in case no analyser has done it. It
  * also counts a failed request if the server state has not reached the request
  * stage.
  */
-static void sess_set_term_flags(struct session *s)
+static void sess_set_term_flags(struct stream *s)
 {
 	if (!(s->flags & SN_FINST_MASK)) {
 		if (s->si[1].state < SI_ST_REQ) {
@@ -1276,7 +1276,7 @@
  * or SI_ST_EST for a successful connection to an applet. It may also return
  * SI_ST_QUE, or SI_ST_CLO upon error.
  */
-static void sess_prepare_conn_req(struct session *s)
+static void sess_prepare_conn_req(struct stream *s)
 {
 	struct stream_interface *si = &s->si[1];
 
@@ -1355,14 +1355,14 @@
  * It returns 1 if the processing can continue on next analysers, or zero if it
  * either needs more data or wants to immediately abort the request.
  */
-static int process_switching_rules(struct session *s, struct channel *req, int an_bit)
+static int process_switching_rules(struct stream *s, struct channel *req, int an_bit)
 {
 	struct persist_rule *prst_rule;
 
 	req->analysers &= ~an_bit;
 	req->analyse_exp = TICK_ETERNITY;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -1403,7 +1403,7 @@
 				else
 					backend = rule->be.backend;
 
-				if (!session_set_backend(s, backend))
+				if (!stream_set_backend(s, backend))
 					goto sw_failed;
 				break;
 			}
@@ -1415,7 +1415,7 @@
 		 * backend if any.
 		 */
 		if (!(s->flags & SN_BE_ASSIGNED))
-			if (!session_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be))
+			if (!stream_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be))
 				goto sw_failed;
 	}
 
@@ -1426,7 +1426,7 @@
 	}
 
 	/* as soon as we know the backend, we must check if we have a matching forced or ignored
-	 * persistence rule, and report that in the session.
+	 * persistence rule, and report that in the stream.
 	 */
 	list_for_each_entry(prst_rule, &s->be->persist_rules, list) {
 		int ret = 1;
@@ -1471,12 +1471,12 @@
  * it then returns 1. The data must already be present in the buffer otherwise
  * they won't match. It always returns 1.
  */
-static int process_server_rules(struct session *s, struct channel *req, int an_bit)
+static int process_server_rules(struct stream *s, struct channel *req, int an_bit)
 {
 	struct proxy *px = s->be;
 	struct server_rule *rule;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -1520,12 +1520,12 @@
  * it then returns 1. The data must already be present in the buffer otherwise
  * they won't match. It always returns 1.
  */
-static int process_sticking_rules(struct session *s, struct channel *req, int an_bit)
+static int process_sticking_rules(struct stream *s, struct channel *req, int an_bit)
 {
 	struct proxy    *px   = s->be;
 	struct sticking_rule  *rule;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		req,
@@ -1616,14 +1616,14 @@
  * then returns 1. The data must already be present in the buffer otherwise
  * they won't match. It always returns 1.
  */
-static int process_store_rules(struct session *s, struct channel *rep, int an_bit)
+static int process_store_rules(struct stream *s, struct channel *rep, int an_bit)
 {
 	struct proxy    *px   = s->be;
 	struct sticking_rule  *rule;
 	int i;
 	int nbreq = s->store_count;
 
-	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
+	DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
 		now_ms, __FUNCTION__,
 		s,
 		rep,
@@ -1714,7 +1714,7 @@
 }
 
 /* This macro is very specific to the function below. See the comments in
- * process_session() below to understand the logic and the tests.
+ * process_stream() below to understand the logic and the tests.
  */
 #define UPDATE_ANALYSERS(real, list, back, flag) {			\
 		list = (((list) & ~(flag)) | ~(back)) & (real);		\
@@ -1725,7 +1725,7 @@
 			continue;					\
 }
 
-/* Processes the client, server, request and response jobs of a session task,
+/* Processes the client, server, request and response jobs of a stream task,
  * then puts it back to the wait queue in a clean state, or cleans up its
  * resources if it must be deleted. Returns in <next> the date the task wants
  * to be woken up, or TICK_ETERNITY. In order not to call all functions for
@@ -1733,10 +1733,10 @@
  * and each function is called only if at least another function has changed at
  * least one flag it is interested in.
  */
-struct task *process_session(struct task *t)
+struct task *process_stream(struct task *t)
 {
 	struct server *srv;
-	struct session *s = t->context;
+	struct stream *s = t->context;
 	unsigned int rqf_last, rpf_last;
 	unsigned int rq_prod_last, rq_cons_last;
 	unsigned int rp_cons_last, rp_prod_last;
@@ -1809,7 +1809,7 @@
 
 		/* Once in a while we're woken up because the task expires. But
 		 * this does not necessarily mean that a timeout has been reached.
-		 * So let's not run a whole session processing if only an expiration
+		 * So let's not run a whole stream processing if only an expiration
 		 * timeout needs to be refreshed.
 		 */
 		if (!((req->flags | res->flags) &
@@ -1823,7 +1823,7 @@
 	/* below we may emit error messages so we have to ensure that we have
 	 * our buffers properly allocated.
 	 */
-	if (!session_alloc_work_buffer(s)) {
+	if (!stream_alloc_work_buffer(s)) {
 		/* No buffer available, we've been subscribed to the list of
 		 * buffer waiters, let's wait for our turn.
 		 */
@@ -1969,7 +1969,7 @@
 			 * the list when not needed. Any analyser may return 0
 			 * to break out of the loop, either because of missing
 			 * data to take a decision, or because it decides to
-			 * kill the session. We loop at least once through each
+			 * kill the stream. We loop at least once through each
 			 * analyser, and we may loop again if other analysers
 			 * are added in the middle.
 			 *
@@ -2139,7 +2139,7 @@
 			 * the list when not needed. Any analyser may return 0
 			 * to break out of the loop, either because of missing
 			 * data to take a decision, or because it decides to
-			 * kill the session. We loop at least once through each
+			 * kill the stream. We loop at least once through each
 			 * analyser, and we may loop again if other analysers
 			 * are added in the middle.
 			 */
@@ -2202,7 +2202,7 @@
 
 
 	/*
-	 * Now we propagate unhandled errors to the session. Normally
+	 * Now we propagate unhandled errors to the stream. Normally
 	 * we're just in a data phase here since it means we have not
 	 * seen any analyser who could set an error status.
 	 */
@@ -2589,7 +2589,7 @@
 		   (si_b->state > SI_ST_INI && si_b->state < SI_ST_CLO))) {
 
 		if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SN_BE_ASSIGNED))
-			session_process_counters(s);
+			stream_process_counters(s);
 
 		if (si_f->state == SI_ST_EST && obj_type(si_f->end) != OBJ_TYPE_APPCTX)
 			si_update(si_f);
@@ -2630,7 +2630,7 @@
 		if ((si_applet_call(si_b) | si_applet_call(si_f)) != 0) {
 			if (task_in_rq(t)) {
 				t->expire = TICK_ETERNITY;
-				session_release_buffers(s);
+				stream_release_buffers(s);
 				return t;
 			}
 		}
@@ -2660,7 +2660,7 @@
 		if (!tick_isset(t->expire))
 			ABORT_NOW();
 #endif
-		session_release_buffers(s);
+		stream_release_buffers(s);
 		return t; /* nothing more to do */
 	}
 
@@ -2694,7 +2694,7 @@
 	}
 
 	s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);
-	session_process_counters(s);
+	stream_process_counters(s);
 
 	if (s->txn.status) {
 		int n;
@@ -2724,18 +2724,18 @@
 		s->do_log(s);
 	}
 
-	/* update time stats for this session */
-	session_update_time_stats(s);
+	/* update time stats for this stream */
+	stream_update_time_stats(s);
 
 	/* the task MUST not be in the run queue anymore */
-	session_free(s);
+	stream_free(s);
 	task_delete(t);
 	task_free(t);
 	return NULL;
 }
 
-/* Update the session's backend and server time stats */
-void session_update_time_stats(struct session *s)
+/* Update the stream's backend and server time stats */
+void stream_update_time_stats(struct stream *s)
 {
 	int t_request;
 	int t_queue;
@@ -2778,12 +2778,12 @@
 
 /*
  * This function adjusts sess->srv_conn and maintains the previous and new
- * server's served session counts. Setting newsrv to NULL is enough to release
+ * server's served stream counts. Setting newsrv to NULL is enough to release
  * current connection slot. This function also notifies any LB algo which might
- * expect to be informed about any change in the number of active sessions on a
+ * expect to be informed about any change in the number of active streams on a
  * server.
  */
-void sess_change_server(struct session *sess, struct server *newsrv)
+void sess_change_server(struct stream *sess, struct server *newsrv)
 {
 	if (sess->srv_conn == newsrv)
 		return;
@@ -2792,23 +2792,23 @@
 		sess->srv_conn->served--;
 		if (sess->srv_conn->proxy->lbprm.server_drop_conn)
 			sess->srv_conn->proxy->lbprm.server_drop_conn(sess->srv_conn);
-		session_del_srv_conn(sess);
+		stream_del_srv_conn(sess);
 	}
 
 	if (newsrv) {
 		newsrv->served++;
 		if (newsrv->proxy->lbprm.server_take_conn)
 			newsrv->proxy->lbprm.server_take_conn(newsrv);
-		session_add_srv_conn(sess, newsrv);
+		stream_add_srv_conn(sess, newsrv);
 	}
 }
 
 /* Handle server-side errors for default protocols. It is called whenever a a
  * connection setup is aborted or a request is aborted in queue. It sets the
- * session termination flags so that the caller does not have to worry about
+ * stream termination flags so that the caller does not have to worry about
  * them. It's installed as ->srv_error for the server-side stream_interface.
  */
-void default_srv_error(struct session *s, struct stream_interface *si)
+void default_srv_error(struct stream *s, struct stream_interface *si)
 {
 	int err_type = si->err_type;
 	int err = 0, fin = 0;
@@ -2852,18 +2852,18 @@
 		s->flags |= fin;
 }
 
-/* kill a session and set the termination flags to <why> (one of SN_ERR_*) */
-void session_shutdown(struct session *session, int why)
+/* kill a stream and set the termination flags to <why> (one of SN_ERR_*) */
+void stream_shutdown(struct stream *stream, int why)
 {
-	if (session->req.flags & (CF_SHUTW|CF_SHUTW_NOW))
+	if (stream->req.flags & (CF_SHUTW|CF_SHUTW_NOW))
 		return;
 
-	channel_shutw_now(&session->req);
-	channel_shutr_now(&session->res);
-	session->task->nice = 1024;
-	if (!(session->flags & SN_ERR_MASK))
-		session->flags |= why;
-	task_wakeup(session->task, TASK_WOKEN_OTHER);
+	channel_shutw_now(&stream->req);
+	channel_shutr_now(&stream->res);
+	stream->task->nice = 1024;
+	if (!(stream->flags & SN_ERR_MASK))
+		stream->flags |= why;
+	task_wakeup(stream->task, TASK_WOKEN_OTHER);
 }
 
 /************************************************************************/
@@ -2873,7 +2873,7 @@
 /* Returns a pointer to a stkctr depending on the fetch keyword name.
  * It is designed to be called as sc[0-9]_* sc_* or src_* exclusively.
  * sc[0-9]_* will return a pointer to the respective field in the
- * session <l4>. sc_* requires an UINT argument specifying the stick
+ * stream <l4>. sc_* requires an UINT argument specifying the stick
  * counter number. src_* will fill a locally allocated structure with
  * the table and entry corresponding to what is specified with src_*.
  * NULL may be returned if the designated stkctr is not tracked. For
@@ -2884,7 +2884,7 @@
  * multiple tables).
  */
 struct stkctr *
-smp_fetch_sc_stkctr(struct session *l4, const struct arg *args, const char *kw)
+smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
 {
 	static struct stkctr stkctr;
 	struct stksess *stksess;
@@ -2930,12 +2930,12 @@
 	return &l4->stkctr[num];
 }
 
-/* set return a boolean indicating if the requested session counter is
+/* set return a boolean indicating if the requested stream counter is
  * currently being tracked or not.
  * Supports being called as "sc[0-9]_tracked" only.
  */
 static int
-smp_fetch_sc_tracked(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_tracked(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -2944,13 +2944,13 @@
 	return 1;
 }
 
-/* set <smp> to the General Purpose Counter 0 value from the session's tracked
+/* set <smp> to the General Purpose Counter 0 value from the stream's tracked
  * frontend counters or from the src.
  * Supports being called as "sc[0-9]_get_gpc0" or "src_get_gpc0" only. Value
  * zero is returned if the key is new.
  */
 static int
-smp_fetch_sc_get_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_get_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -2971,13 +2971,13 @@
 	return 1;
 }
 
-/* set <smp> to the General Purpose Counter 0's event rate from the session's
+/* set <smp> to the General Purpose Counter 0's event rate from the stream's
  * tracked frontend counters or from the src.
  * Supports being called as "sc[0-9]_gpc0_rate" or "src_gpc0_rate" only.
  * Value zero is returned if the key is new.
  */
 static int
-smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_gpc0_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -2998,12 +2998,12 @@
 	return 1;
 }
 
-/* Increment the General Purpose Counter 0 value from the session's tracked
+/* Increment the General Purpose Counter 0 value from the stream's tracked
  * frontend counters and return it into temp integer.
  * Supports being called as "sc[0-9]_inc_gpc0" or "src_inc_gpc0" only.
  */
 static int
-smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_inc_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3035,12 +3035,12 @@
 	return 1;
 }
 
-/* Clear the General Purpose Counter 0 value from the session's tracked
+/* Clear the General Purpose Counter 0 value from the stream's tracked
  * frontend counters and return its previous value into temp integer.
  * Supports being called as "sc[0-9]_clr_gpc0" or "src_clr_gpc0" only.
  */
 static int
-smp_fetch_sc_clr_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_clr_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3061,12 +3061,12 @@
 	return 1;
 }
 
-/* set <smp> to the cumulated number of connections from the session's tracked
+/* set <smp> to the cumulated number of connections from the stream's tracked
  * frontend counters. Supports being called as "sc[0-9]_conn_cnt" or
  * "src_conn_cnt" only.
  */
 static int
-smp_fetch_sc_conn_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3086,12 +3086,12 @@
 	return 1;
 }
 
-/* set <smp> to the connection rate from the session's tracked frontend
+/* set <smp> to the connection rate from the stream's tracked frontend
  * counters. Supports being called as "sc[0-9]_conn_rate" or "src_conn_rate"
  * only.
  */
 static int
-smp_fetch_sc_conn_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_conn_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3112,12 +3112,12 @@
 	return 1;
 }
 
-/* set temp integer to the number of connections from the session's source address
+/* set temp integer to the number of connections from the stream's source address
  * in the table pointed to by expr, after updating it.
  * Accepts exactly 1 argument of type table.
  */
 static int
-smp_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                             const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct connection *conn = objt_conn(l4->si[0].end);
@@ -3148,12 +3148,12 @@
 	return 1;
 }
 
-/* set <smp> to the number of concurrent connections from the session's tracked
+/* set <smp> to the number of concurrent connections from the stream's tracked
  * frontend counters. Supports being called as "sc[0-9]_conn_cur" or
  * "src_conn_cur" only.
  */
 static int
-smp_fetch_sc_conn_cur(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_conn_cur(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3173,12 +3173,12 @@
 	return 1;
 }
 
-/* set <smp> to the cumulated number of sessions from the session's tracked
+/* set <smp> to the cumulated number of streams from the stream's tracked
  * frontend counters. Supports being called as "sc[0-9]_sess_cnt" or
  * "src_sess_cnt" only.
  */
 static int
-smp_fetch_sc_sess_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_sess_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                       const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3198,11 +3198,11 @@
 	return 1;
 }
 
-/* set <smp> to the session rate from the session's tracked frontend counters.
+/* set <smp> to the stream rate from the stream's tracked frontend counters.
  * Supports being called as "sc[0-9]_sess_rate" or "src_sess_rate" only.
  */
 static int
-smp_fetch_sc_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3223,12 +3223,12 @@
 	return 1;
 }
 
-/* set <smp> to the cumulated number of HTTP requests from the session's tracked
+/* set <smp> to the cumulated number of HTTP requests from the stream's tracked
  * frontend counters. Supports being called as "sc[0-9]_http_req_cnt" or
  * "src_http_req_cnt" only.
  */
 static int
-smp_fetch_sc_http_req_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_http_req_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                           const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3248,12 +3248,12 @@
 	return 1;
 }
 
-/* set <smp> to the HTTP request rate from the session's tracked frontend
+/* set <smp> to the HTTP request rate from the stream's tracked frontend
  * counters. Supports being called as "sc[0-9]_http_req_rate" or
  * "src_http_req_rate" only.
  */
 static int
-smp_fetch_sc_http_req_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_http_req_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                            const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3274,12 +3274,12 @@
 	return 1;
 }
 
-/* set <smp> to the cumulated number of HTTP requests errors from the session's
+/* set <smp> to the cumulated number of HTTP requests errors from the stream's
  * tracked frontend counters. Supports being called as "sc[0-9]_http_err_cnt" or
  * "src_http_err_cnt" only.
  */
 static int
-smp_fetch_sc_http_err_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_http_err_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                           const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3299,12 +3299,12 @@
 	return 1;
 }
 
-/* set <smp> to the HTTP request error rate from the session's tracked frontend
+/* set <smp> to the HTTP request error rate from the stream's tracked frontend
  * counters. Supports being called as "sc[0-9]_http_err_rate" or
  * "src_http_err_rate" only.
  */
 static int
-smp_fetch_sc_http_err_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_http_err_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                            const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3326,11 +3326,11 @@
 }
 
 /* set <smp> to the number of kbytes received from clients, as found in the
- * session's tracked frontend counters. Supports being called as
+ * stream's tracked frontend counters. Supports being called as
  * "sc[0-9]_kbytes_in" or "src_kbytes_in" only.
  */
 static int
-smp_fetch_sc_kbytes_in(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_kbytes_in(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3351,11 +3351,11 @@
 }
 
 /* set <smp> to the data rate received from clients in bytes/s, as found
- * in the session's tracked frontend counters. Supports being called as
+ * in the stream's tracked frontend counters. Supports being called as
  * "sc[0-9]_bytes_in_rate" or "src_bytes_in_rate" only.
  */
 static int
-smp_fetch_sc_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_bytes_in_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                            const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3377,11 +3377,11 @@
 }
 
 /* set <smp> to the number of kbytes sent to clients, as found in the
- * session's tracked frontend counters. Supports being called as
+ * stream's tracked frontend counters. Supports being called as
  * "sc[0-9]_kbytes_out" or "src_kbytes_out" only.
  */
 static int
-smp_fetch_sc_kbytes_out(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_kbytes_out(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3402,11 +3402,11 @@
 }
 
 /* set <smp> to the data rate sent to clients in bytes/s, as found in the
- * session's tracked frontend counters. Supports being called as
+ * stream's tracked frontend counters. Supports being called as
  * "sc[0-9]_bytes_out_rate" or "src_bytes_out_rate" only.
  */
 static int
-smp_fetch_sc_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_bytes_out_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                             const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3427,11 +3427,11 @@
 	return 1;
 }
 
-/* set <smp> to the number of active trackers on the SC entry in the session's
+/* set <smp> to the number of active trackers on the SC entry in the stream's
  * tracked frontend counters. Supports being called as "sc[0-9]_trackers" only.
  */
 static int
-smp_fetch_sc_trackers(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_sc_trackers(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw);
@@ -3449,7 +3449,7 @@
  * Accepts exactly 1 argument of type table.
  */
 static int
-smp_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_table_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->flags = SMP_F_VOL_TEST;
@@ -3462,7 +3462,7 @@
  * Accepts exactly 1 argument of type table.
  */
 static int
-smp_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+smp_fetch_table_avl(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
                     const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	px = args->data.prx;
@@ -3583,7 +3583,7 @@
 }};
 
 __attribute__((constructor))
-static void __session_init(void)
+static void __stream_init(void)
 {
 	sample_register_fetches(&smp_fetch_keywords);
 	acl_register_keywords(&acl_kws);
diff --git a/src/stream_interface.c b/src/stream_interface.c
index b97c9c8..b8ed071 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -30,7 +30,7 @@
 #include <proto/channel.h>
 #include <proto/connection.h>
 #include <proto/pipe.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 
@@ -629,7 +629,7 @@
 	if (ic->flags & CF_READ_ACTIVITY)
 		ic->flags &= ~CF_READ_DONTWAIT;
 
-	session_release_buffers(si_sess(si));
+	stream_release_buffers(si_strm(si));
 	return 0;
 }
 
@@ -1149,7 +1149,7 @@
 	}
 
 	/* now we'll need a buffer */
-	if (!session_alloc_recv_buffer(ic)) {
+	if (!stream_alloc_recv_buffer(ic)) {
 		si->flags |= SI_FL_WAIT_ROOM;
 		goto end_recv;
 	}
@@ -1330,7 +1330,7 @@
 
 	if (si->flags & SI_FL_NOHALF) {
 		/* we want to immediately forward this close to the write side */
-		/* force flag on ssl to keep session in cache */
+		/* force flag on ssl to keep stream in cache */
 		conn_data_shutw_hard(conn);
 		goto do_close;
 	}
diff --git a/src/task.c b/src/task.c
index d475322..4a8b907 100644
--- a/src/task.c
+++ b/src/task.c
@@ -20,7 +20,7 @@
 #include <eb32tree.h>
 
 #include <proto/proxy.h>
-#include <proto/session.h>
+#include <proto/stream.h>
 #include <proto/task.h>
 
 struct pool_head *pool2_task;
@@ -234,8 +234,8 @@
 		 * predictor take this most common call.
 		 */
 		t->calls++;
-		if (likely(t->process == process_session))
-			t = process_session(t);
+		if (likely(t->process == process_stream))
+			t = process_stream(t);
 		else
 			t = t->process(t);