MINOR: http: compute response time before processing headers

At the moment, HTTP response time is computed after response headers are
processed. This can misleadingly assign to the server some heavy local
processing (eg: regex), and also prevents response headers from passing
information related to the response time (which can sometimes be useful
for stats).

Let's retrieve the reponse time before processing the headers instead.

Note that in order to remain compatible with what was previously done,
we disable the response time when we get a 502 or any bad response. This
should probably be changed in 1.6 since it does not make sense anymore
to lose this information.
diff --git a/src/proto_http.c b/src/proto_http.c
index 6ab2676..5e10ba2 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -5700,6 +5700,9 @@
 		}
 	}
 
+	/* we want to have the response time before we start processing it */
+	t->logs.t_data = tv_ms_elapsed(&t->logs.tv_accept, &now);
+
 	if (1) {
 		/*
 		 * 3: we will have to evaluate the filters.
@@ -5731,6 +5734,7 @@
 				return_srv_prx_502:
 					rep->analysers = 0;
 					txn->status = 502;
+					t->logs.t_data = -1; /* was not a valid response */
 					rep->prod->flags |= SI_FL_NOLINGER;
 					bi_erase(rep);
 					stream_int_retnclose(rep->cons, http_error_message(t, HTTP_ERR_502));
@@ -5788,6 +5792,7 @@
 			msg->next -= channel_forward(rep, msg->next);
 			msg->msg_state = HTTP_MSG_RPBEFORE;
 			txn->status = 0;
+			t->logs.t_data = -1; /* was not a response yet */
 			rep->analysers |= AN_RES_WAIT_HTTP | an_bit;
 			return 1;
 		}
@@ -5960,8 +5965,6 @@
 		 * could. Let's switch to the DATA state.                    *
 		 ************************************************************/
 
-		t->logs.t_data = tv_ms_elapsed(&t->logs.tv_accept, &now);
-
 		/* if the user wants to log as soon as possible, without counting
 		 * bytes from the server, then this is the right moment. We have
 		 * to temporarily assign bytes_out to log what we currently have.