[CLEANUP] renamed several HTTP structures

Some parts of HTTP processing were incorrectly called "request" while
they are messages or transactions. The following structure members
have changed :

  http_msg.hdr_state => msg_state
  http_msg.sor => som
  http_req.req_state => removed
  http_req => http_txn
diff --git a/doc/internals/http-parsing.txt b/doc/internals/http-parsing.txt
index 7e731c8..fd41b6e 100644
--- a/doc/internals/http-parsing.txt
+++ b/doc/internals/http-parsing.txt
@@ -223,17 +223,17 @@
   without optimal support for HTTP pipelining will have the client buffers tied
   to the http_session. It may be possible that it is not sufficient for full
   pipelining, but this will need further study. The link from the buffers to
-  the backend should be managed by the http_request, provided that they are
-  serialized. Each http_session, has 0 to N http_requests. Each http_request
-  belongs to one and only one http_session.
+  the backend should be managed by the http transaction (http_txn), provided
+  that they are serialized. Each http_session, has 0 to N http_txn. Each
+  http_txn belongs to one and only one http_session.
 
-- each http_request has 1 request message, and 0 or 1 response message. Each of
-  them has 1 and only one http_request. An http_request holds informations such
-  as the HTTP method, the URI, the HTTP version, the transfer-encoding, the
-  HTTP status, the authorization, the req and resp content-length, the timers,
-  logs, etc... The backend and server which process the request are also known
-  from the http_request.
+- each http_txn has 1 request message (http_req), and 0 or 1 response message
+  (http_rtr). Each of them has 1 and only one http_txn. An http_txn holds
+  informations such as the HTTP method, the URI, the HTTP version, the
+  transfer-encoding, the HTTP status, the authorization, the req and rtr
+  content-length, the timers, logs, etc... The backend and server which process
+  the request are also known from the http_txn.
 
 - both request and response messages hold header and parsing informations, such
-  as the parsing state, start of headers, start of request, captures, etc...
+  as the parsing state, start of headers, start of message, captures, etc...
 
diff --git a/include/types/session.h b/include/types/session.h
index bbb0ebe..885c3ff 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -123,7 +123,7 @@
  * The values there are a little bit obscure, because their meaning can change
  * during the parsing :
  *
- *  - sor (Start of Request) : relative offset in the buffer of first byte of
+ *  - som (Start of Message) : relative offset in the buffer of first byte of
  *                             the request being processed or parsed. Reset to
  *                             zero during accept().
  *  - eoh (End of Headers)   : relative offset in the buffer of first byte that
@@ -134,33 +134,32 @@
  *                             which marks the end of the line (LF or CRLF).
  */
 struct http_msg {
-	int hdr_state;                  /* where we are in the current header parsing */
+	int msg_state;                  /* where we are in the current message parsing */
 	char *sol, *eol;		/* start of line, end of line */
-	int sor;			/* Start Of Request, relative to buffer */
+	int som;			/* Start Of Message, relative to buffer */
 	int col, sov;			/* current header: colon, start of value */
 	int eoh;			/* End Of Headers, relative to buffer */
 	char **cap;			/* array of captured headers (may be NULL) */
 	union {				/* useful start line pointers, relative to buffer */
 		struct {
 			int l;		/* request line length (not including CR) */
-			int m_l;	/* METHOD length (method starts at ->sor) */
+			int m_l;	/* METHOD length (method starts at ->som) */
 			int u, u_l;	/* URI, length */
 			int v, v_l;	/* VERSION, length */
 		} rq;			/* request line : field, length */
 		struct {
 			int l;		/* status line length (not including CR) */
-			int v_l;	/* VERSION length (version starts at ->sor) */
+			int v_l;	/* VERSION length (version starts at ->som) */
 			int c, c_l;	/* CODE, length */
 			int r, r_l;	/* REASON, length */
 		} st;			/* status line : field, length */
 	} sl;				/* start line */
 };
 
-/* This is an HTTP request, as described in RFC2616. It contains both a request
- * message and a response message (which can be empty).
+/* This is an HTTP transaction. It contains both a request message and a
+ * response message (which can be empty).
  */
-struct http_req {
-	int req_state;                  /* what we are currently parsing */
+struct http_txn {
 	http_meth_t meth;		/* HTTP method */
 	struct hdr_idx hdr_idx;         /* array of header indexes (max: MAX_HTTP_HDR) */
 	struct chunk auth_hdr;		/* points to 'Authorization:' header */
@@ -187,7 +186,7 @@
 	struct sockaddr_in srv_addr;		/* the address to connect to */
 	struct server *srv;			/* the server being used */
 	struct pendconn *pend_pos;		/* if not NULL, points to the position in the pending queue */
-	struct http_req hreq;			/* current HTTP request being processed. Should become a list. */
+	struct http_txn txn;			/* current HTTP transaction being processed. Should become a list. */
 	struct {
 		int logwait;			/* log fields waiting to be collected : LW_* */
 		struct timeval tv_accept;	/* date of the accept() (beginning of the session) */
diff --git a/src/client.c b/src/client.c
index e4babba..04960a9 100644
--- a/src/client.c
+++ b/src/client.c
@@ -56,7 +56,7 @@
 int event_accept(int fd) {
 	struct proxy *p = (struct proxy *)fdtab[fd].owner;
 	struct session *s;
-	struct http_req *hreq;
+	struct http_txn *hreq;
 	struct task *t;
 	int cfd;
 	int max_accept;
@@ -198,16 +198,16 @@
 		s->uniq_id = totalconn;
 		p->cum_feconn++;	/* cum_beconn will be increased once assigned */
 
-		hreq = &s->hreq;
+		hreq = &s->txn;
 		hreq->req.cap = NULL;
 		hreq->rsp.cap = NULL;
 		hreq->hdr_idx.v = NULL;
 		hreq->hdr_idx.size = hreq->hdr_idx.used = 0;
 
 		if (p->mode == PR_MODE_HTTP) {
-			hreq->req.hdr_state = HTTP_MSG_RQBEFORE; /* at the very beginning of the request */
+			hreq->req.msg_state = HTTP_MSG_RQBEFORE; /* at the very beginning of the request */
 			hreq->req.sol = hreq->req.eol = NULL;
-			hreq->req.sor = hreq->req.eoh = 0; /* relative to the buffer */
+			hreq->req.som = hreq->req.eoh = 0; /* relative to the buffer */
 			hreq->auth_hdr.len = -1;
 
 			hreq->hdr_idx.size = MAX_HTTP_HDR;
diff --git a/src/log.c b/src/log.c
index 52e2ecf..5448c7e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -294,7 +294,7 @@
 	struct proxy *fe = s->fe;
 	struct proxy *be = s->be;
 	struct proxy *prx_log;
-	struct http_req *hreq = &s->hreq;
+	struct http_txn *hreq = &s->txn;
 	int log, tolog;
 	char *uri;
 	char *pxid;
diff --git a/src/proto_http.c b/src/proto_http.c
index 6399673..7d89ddc 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -544,7 +544,7 @@
 			EAT_AND_JUMP_OR_RETURN(http_msg_rpver, HTTP_MSG_RPVER);
 
 		if (likely(HTTP_IS_SPHT(*ptr))) {
-			msg->sl.st.v_l = (ptr - msg_buf) - msg->sor;
+			msg->sl.st.v_l = (ptr - msg_buf) - msg->som;
 			EAT_AND_JUMP_OR_RETURN(http_msg_rpver_sp, HTTP_MSG_RPVER_SP);
 		}
 		goto http_msg_invalid;
@@ -667,13 +667,13 @@
 			EAT_AND_JUMP_OR_RETURN(http_msg_rqmeth, HTTP_MSG_RQMETH);
 
 		if (likely(HTTP_IS_SPHT(*ptr))) {
-			msg->sl.rq.m_l = (ptr - msg_buf) - msg->sor;
+			msg->sl.rq.m_l = (ptr - msg_buf) - msg->som;
 			EAT_AND_JUMP_OR_RETURN(http_msg_rqmeth_sp, HTTP_MSG_RQMETH_SP);
 		}
 
 		if (likely(HTTP_IS_CRLF(*ptr))) {
 			/* HTTP 0.9 request */
-			msg->sl.rq.m_l = (ptr - msg_buf) - msg->sor;
+			msg->sl.rq.m_l = (ptr - msg_buf) - msg->som;
 		http_msg_req09_uri:
 			msg->sl.rq.u = ptr - msg_buf;
 		http_msg_req09_uri_e:
@@ -760,7 +760,7 @@
 
 /*
  * This function parses an HTTP message, either a request or a response,
- * depending on the initial msg->hdr_state. It can be preempted everywhere
+ * depending on the initial msg->msg_state. It can be preempted everywhere
  * when data are missing and recalled at the exact same location with no
  * information loss. The header index is re-initialized when switching from
  * MSG_R[PQ]BEFORE to MSG_RPVER|MSG_RQMETH.
@@ -788,7 +788,7 @@
 	int state;                /* updated only when leaving the FSM */
 	register char *ptr, *end; /* request pointers, to avoid dereferences */
 
-	state = msg->hdr_state;
+	state = msg->msg_state;
 	ptr = buf->lr;
 	end = buf->r;
 
@@ -806,12 +806,12 @@
 		if (likely(HTTP_IS_TOKEN(*ptr))) {
 			if (likely(ptr == buf->data)) {
 				msg->sol = ptr;
-				msg->sor = 0;
+				msg->som = 0;
 			} else {
 #if PARSE_PRESERVE_EMPTY_LINES
 				/* only skip empty leading lines, don't remove them */
 				msg->sol = ptr;
-				msg->sor = ptr - buf->data;
+				msg->som = ptr - buf->data;
 #else
 				/* Remove empty leading lines, as recommended by
 				 * RFC2616. This takes a lot of time because we
@@ -822,7 +822,7 @@
 				 */
 				buf->lr = ptr;
 				buffer_replace2(buf, buf->data, buf->lr, NULL, 0);
-				msg->sor = 0;
+				msg->som = 0;
 				msg->sol = buf->data;
 				ptr = buf->data;
 				end = buf->r;
@@ -854,14 +854,14 @@
 	case HTTP_MSG_RPCODE_SP:
 	case HTTP_MSG_RPREASON:
 		ptr = (char *)http_parse_rspline(msg, buf->data, state, ptr, end,
-						 &buf->lr, &msg->hdr_state);
+						 &buf->lr, &msg->msg_state);
 		if (unlikely(!ptr))
 			return;
 
 		/* we have a full response and we know that we have either a CR
 		 * or an LF at <ptr>.
 		 */
-		//fprintf(stderr,"sor=%d rq.l=%d *ptr=0x%02x\n", msg->sor, msg->sl.st.l, *ptr);
+		//fprintf(stderr,"som=%d rq.l=%d *ptr=0x%02x\n", msg->som, msg->sl.st.l, *ptr);
 		hdr_idx_set_start(idx, msg->sl.st.l, *ptr == '\r');
 
 		msg->sol = ptr;
@@ -884,12 +884,12 @@
 		if (likely(HTTP_IS_TOKEN(*ptr))) {
 			if (likely(ptr == buf->data)) {
 				msg->sol = ptr;
-				msg->sor = 0;
+				msg->som = 0;
 			} else {
 #if PARSE_PRESERVE_EMPTY_LINES
 				/* only skip empty leading lines, don't remove them */
 				msg->sol = ptr;
-				msg->sor = ptr - buf->data;
+				msg->som = ptr - buf->data;
 #else
 				/* Remove empty leading lines, as recommended by
 				 * RFC2616. This takes a lot of time because we
@@ -900,7 +900,7 @@
 				 */
 				buf->lr = ptr;
 				buffer_replace2(buf, buf->data, buf->lr, NULL, 0);
-				msg->sor = 0;
+				msg->som = 0;
 				msg->sol = buf->data;
 				ptr = buf->data;
 				end = buf->r;
@@ -934,14 +934,14 @@
 	case HTTP_MSG_RQURI_SP:
 	case HTTP_MSG_RQVER:
 		ptr = (char *)http_parse_reqline(msg, buf->data, state, ptr, end,
-						 &buf->lr, &msg->hdr_state);
+						 &buf->lr, &msg->msg_state);
 		if (unlikely(!ptr))
 			return;
 
 		/* we have a full request and we know that we have either a CR
 		 * or an LF at <ptr>.
 		 */
-		//fprintf(stderr,"sor=%d rq.l=%d *ptr=0x%02x\n", msg->sor, msg->sl.rq.l, *ptr);
+		//fprintf(stderr,"som=%d rq.l=%d *ptr=0x%02x\n", msg->som, msg->sl.rq.l, *ptr);
 		hdr_idx_set_start(idx, msg->sl.rq.l, *ptr == '\r');
 
 		msg->sol = ptr;
@@ -1086,7 +1086,7 @@
 		ptr++;
 		buf->lr = ptr;
 		msg->eoh = msg->sol - buf->data;
-		msg->hdr_state = HTTP_MSG_BODY;
+		msg->msg_state = HTTP_MSG_BODY;
 		return;
 #ifdef DEBUG_FULL
 	default:
@@ -1096,13 +1096,13 @@
 	}
  http_msg_ood:
 	/* out of data */
-	msg->hdr_state = state;
+	msg->msg_state = state;
 	buf->lr = ptr;
 	return;
 
  http_msg_invalid:
 	/* invalid message */
-	msg->hdr_state = HTTP_MSG_ERROR;
+	msg->msg_state = HTTP_MSG_ERROR;
 	return;
 }
     
@@ -1144,7 +1144,7 @@
 		 * has to process at req->lr.
 		 *
 		 * Here is the information we currently have :
-		 *   req->data + req->sor  = beginning of request
+		 *   req->data + req->som  = beginning of request
 		 *   req->data + req->eoh  = end of processed headers / start of current one
 		 *   req->data + req->eol  = end of current header or line (LF or CRLF)
 		 *   req->lr = first non-visited byte
@@ -1152,7 +1152,7 @@
 		 */
 
 		int cur_idx;
-		struct http_req *hreq = &t->hreq;
+		struct http_txn *hreq = &t->txn;
 		struct http_msg *msg = &hreq->req;
 		struct proxy *cur_proxy;
 
@@ -1162,10 +1162,10 @@
 		/* 1: we might have to print this header in debug mode */
 		if (unlikely((global.mode & MODE_DEBUG) &&
 			     (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
-			     (msg->hdr_state == HTTP_MSG_BODY || msg->hdr_state == HTTP_MSG_ERROR))) {
+			     (msg->msg_state == HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
 			char *eol, *sol;
 
-			sol = req->data + msg->sor;
+			sol = req->data + msg->som;
 			eol = sol + msg->sl.rq.l;
 			debug_hdr("clireq", t, sol, eol);
 
@@ -1190,11 +1190,11 @@
 		 *
 		 */
 
-		if (unlikely(msg->hdr_state != HTTP_MSG_BODY)) {
+		if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
 			/*
 			 * First, let's catch bad requests.
 			 */
-			if (unlikely(msg->hdr_state == HTTP_MSG_ERROR))
+			if (unlikely(msg->msg_state == HTTP_MSG_ERROR))
 				goto return_bad_req;
 
 			/* 1: Since we are in header mode, if there's no space
@@ -1261,7 +1261,7 @@
 		/*
 		 * 1: identify the method
 		 */
-		hreq->meth = find_http_meth(&req->data[msg->sor], msg->sl.rq.m_l);
+		hreq->meth = find_http_meth(&req->data[msg->som], msg->sl.rq.m_l);
 
 		/*
 		 * 2: check if the URI matches the monitor_uri.
@@ -1294,7 +1294,7 @@
 
 				if (urilen >= REQURI_LEN)
 					urilen = REQURI_LEN - 1;
-				memcpy(t->logs.uri, &req->data[msg->sor], urilen);
+				memcpy(t->logs.uri, &req->data[msg->som], urilen);
 				t->logs.uri[urilen] = 0;
 
 				if (!(t->logs.logwait &= ~LW_REQ))
@@ -1309,7 +1309,7 @@
 		if (unlikely(msg->sl.rq.v_l == 0)) {
 			int delta;
 			char *cur_end;
-			msg->sol = req->data + msg->sor;
+			msg->sol = req->data + msg->som;
 			cur_end = msg->sol + msg->sl.rq.l;
 			delta = 0;
 
@@ -1344,7 +1344,7 @@
 			struct cap_hdr *h;
 			int len;
 
-			sol = req->data + msg->sor + hdr_idx_first_pos(&hreq->hdr_idx);
+			sol = req->data + msg->som + hdr_idx_first_pos(&hreq->hdr_idx);
 			cur_idx = hdr_idx_first_idx(&hreq->hdr_idx);
 
 			while (cur_idx) {
@@ -1446,7 +1446,7 @@
 				int cur_idx, old_idx, delta;
 				struct hdr_idx_elem *cur_hdr;
 
-				cur_next = req->data + hreq->req.sor + hdr_idx_first_pos(&hreq->hdr_idx);
+				cur_next = req->data + hreq->req.som + hdr_idx_first_pos(&hreq->hdr_idx);
 				old_idx = 0;
 
 				while ((cur_idx = hreq->hdr_idx.v[old_idx].next)) {
@@ -1555,7 +1555,7 @@
 
 		/* It needs to look into the URI */
 		if (t->be->beprm->appsession_name) {
-			get_srv_from_appsession(t, &req->data[msg->sor], msg->sl.rq.l);
+			get_srv_from_appsession(t, &req->data[msg->som], msg->sl.rq.l);
 		}
 
 
@@ -1658,7 +1658,7 @@
 		goto process_data;
 
 	return_bad_req: /* let's centralize all bad requests */
-		hreq->req.hdr_state = HTTP_MSG_ERROR;
+		hreq->req.msg_state = HTTP_MSG_ERROR;
 		t->logs.status = 400;
 		client_retnclose(t, error_message(t, HTTP_ERR_400));
 		t->fe->failed_req++;
@@ -1962,7 +1962,7 @@
  */
 int process_srv(struct session *t)
 {
-	struct http_req *hreq = &t->hreq;
+	struct http_txn *hreq = &t->txn;
 	int s = t->srv_state;
 	int c = t->cli_state;
 	struct buffer *req = t->req;
@@ -3193,7 +3193,7 @@
 		if (!(s->flags & SN_FINST_MASK))
 			s->flags |= SN_FINST_R;
 
-		if (s->hreq.meth == HTTP_METH_HEAD) {
+		if (s->txn.meth == HTTP_METH_HEAD) {
 			/* that's all we return in case of HEAD request */
 			s->data_state = DATA_ST_FIN;
 			s->flags &= ~SN_SELF_GEN;
@@ -3642,13 +3642,13 @@
 	char term;
 	char *cur_ptr, *cur_end, *cur_next;
 	int cur_idx, old_idx, last_hdr;
-	struct http_req *hreq = &t->hreq;
+	struct http_txn *hreq = &t->txn;
 	struct hdr_idx_elem *cur_hdr;
 	int len, delta;
 
 	last_hdr = 0;
 
-	cur_next = req->data + hreq->req.sor + hdr_idx_first_pos(&hreq->hdr_idx);
+	cur_next = req->data + hreq->req.som + hdr_idx_first_pos(&hreq->hdr_idx);
 	old_idx = 0;
 
 	while (!last_hdr) {
@@ -3770,7 +3770,7 @@
 	char term;
 	char *cur_ptr, *cur_end;
 	int done;
-	struct http_req *hreq = &t->hreq;
+	struct http_txn *hreq = &t->txn;
 	int len, delta;
 
 
@@ -3786,7 +3786,7 @@
 
 	done = 0;
 
-	cur_ptr = req->data + hreq->req.sor;
+	cur_ptr = req->data + hreq->req.som;
 	cur_end = cur_ptr + hreq->req.sl.rq.l;
 
 	/* Now we have the request line between cur_ptr and cur_end */
@@ -3919,7 +3919,7 @@
  */
 void manage_client_side_cookies(struct session *t, struct buffer *req)
 {
-	struct http_req *hreq = &t->hreq;
+	struct http_txn *hreq = &t->txn;
 	char *p1, *p2, *p3, *p4;
 	char *del_colon, *del_cookie, *colon;
 	int app_cookies;
@@ -3939,7 +3939,7 @@
 	 * we start with the start line.
 	 */
 	old_idx = 0;
-	cur_next = req->data + hreq->req.sor + hdr_idx_first_pos(&hreq->hdr_idx);
+	cur_next = req->data + hreq->req.som + hdr_idx_first_pos(&hreq->hdr_idx);
 
 	while ((cur_idx = hreq->hdr_idx.v[old_idx].next)) {
 		struct hdr_idx_elem *cur_hdr;
@@ -4266,7 +4266,7 @@
 	char *request_line;
 
 	if (t->be->beprm->appsession_name == NULL ||
-	    (t->hreq.meth != HTTP_METH_GET && t->hreq.meth != HTTP_METH_POST) ||
+	    (t->txn.meth != HTTP_METH_GET && t->txn.meth != HTTP_METH_POST) ||
 	    (request_line = memchr(begin, ';', len)) == NULL ||
 	    ((1 + t->be->beprm->appsession_name_len + 1 + t->be->beprm->appsession_len) > (begin + len - request_line)))
 		return;
@@ -4354,7 +4354,7 @@
  */
 int stats_check_uri_auth(struct session *t, struct proxy *backend)
 {
-	struct http_req *hreq = &t->hreq;
+	struct http_txn *hreq = &t->txn;
 	struct uri_auth *uri_auth = backend->uri_auth;
 	struct user_auth *user;
 	int authenticated, cur_idx;
@@ -4386,7 +4386,7 @@
 
 		/* FIXME: this should move to an earlier place */
 		cur_idx = 0;
-		h = t->req->data + hreq->req.sor + hdr_idx_first_pos(&hreq->hdr_idx);
+		h = t->req->data + hreq->req.som + hdr_idx_first_pos(&hreq->hdr_idx);
 		while ((cur_idx = hreq->hdr_idx.v[cur_idx].next)) {
 			int len = hreq->hdr_idx.v[cur_idx].len;
 			if (len > 14 &&
diff --git a/src/session.c b/src/session.c
index 1bf0f27..8943911 100644
--- a/src/session.c
+++ b/src/session.c
@@ -33,7 +33,7 @@
  */
 void session_free(struct session *s)
 {
-	struct http_req *hreq = &s->hreq;
+	struct http_txn *hreq = &s->txn;
 
 	if (s->pend_pos)
 		pendconn_free(s->pend_pos);