[MINOR] http: detect connection: close earlier

Till now we would only set SN_CONN_CLOSED after rewriting it. Now we
set it just after checking the Connection header so that we can use
the result later if required.
diff --git a/src/proto_http.c b/src/proto_http.c
index 2300738..a68335c 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2166,6 +2166,12 @@
 			}
 			old_idx = cur_idx;
 		}
+
+		/* if there was no Connection header and we're in HTTP/1.0, then "close" is implied */
+		if (!(s->flags & SN_CONN_CLOSED) && (msg->sl.rq.v_l == 8) &&
+		    (req->data[msg->som + msg->sl.rq.v + 5] == '1') &&
+		    (req->data[msg->som + msg->sl.rq.v + 7] == '0'))
+			s->flags |= SN_CONN_CLOSED;
 	}
 	/* add request headers from the rule sets in the same order */
 	for (cur_idx = 0; cur_idx < px->nb_reqadd; cur_idx++) {
@@ -2498,15 +2504,10 @@
 		}
 	}
 
-	/*
-	 * 11: add "Connection: close" if needed and not yet set.
-	 * Note that we do not need to add it in case of HTTP/1.0.
-	 */
+	/* 11: add "Connection: close" if needed and not yet set. */
 	if (!(s->flags & SN_CONN_CLOSED) &&
 	    ((s->fe->options | s->be->options) & (PR_O_HTTP_CLOSE|PR_O_FORCE_CLO))) {
-		if ((unlikely(msg->sl.rq.v_l != 8) ||
-		     unlikely(req->data[msg->som + msg->sl.rq.v + 7] != '0')) &&
-		    unlikely(http_header_add_tail2(req, &txn->req, &txn->hdr_idx,
+		if (unlikely(http_header_add_tail2(req, &txn->req, &txn->hdr_idx,
 						   "Connection: close", 17)) < 0)
 			goto return_bad_req;
 		s->flags |= SN_CONN_CLOSED;