MINOR: filters/http: Use a wrapper function instead of stream_int_retnclose

The function http_reply_and_close has been added in proto_http.c to wrap calls
to stream_int_retnclose. This functions will be modified when the filters will
be added.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index a1b0cb3..ef564dc 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -132,6 +132,7 @@
 struct act_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
 void free_http_req_rules(struct list *r);
 void free_http_res_rules(struct list *r);
+void http_reply_and_close(struct stream *s, short status, struct chunk *msg);
 struct chunk *http_error_message(struct stream *s, int msgnum);
 struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
                                                const char **args, char **errmsg, int use_fmt, int dir);
diff --git a/src/proto_http.c b/src/proto_http.c
index 46b304f..e362a96 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -963,6 +963,12 @@
 		return &http_err_chunks[msgnum];
 }
 
+void
+http_reply_and_close(struct stream *s, short status, struct chunk *msg)
+{
+	stream_int_retnclose(&s->si[0], msg);
+}
+
 /*
  * returns a known method among HTTP_METH_* or HTTP_METH_OTHER for all unknown
  * ones.
@@ -2804,8 +2810,8 @@
 			}
 
 			txn->status = 400;
-			stream_int_retnclose(&s->si[0], NULL);
 			msg->msg_state = HTTP_MSG_ERROR;
+			http_reply_and_close(s, txn->status, NULL);
 			req->analysers = 0;
 
 			stream_inc_http_req_ctr(s);
@@ -2836,8 +2842,8 @@
 				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;
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_408));
 			req->analysers = 0;
 
 			stream_inc_http_req_ctr(s);
@@ -2865,8 +2871,8 @@
 			if (msg->err_pos >= 0)
 				http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
 			txn->status = 400;
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
 			msg->msg_state = HTTP_MSG_ERROR;
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 			req->analysers = 0;
 
 			stream_inc_http_err_ctr(s);
@@ -2928,7 +2934,7 @@
 		s->logs.logwait = 0;
 		s->logs.level = 0;
 		s->res.flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
-		stream_int_retnclose(&s->si[0], NULL);
+		http_reply_and_close(s, txn->status, NULL);
 		return 0;
 	}
 
@@ -2996,7 +3002,7 @@
 			if (ret) {
 				/* we fail this request, let's return 503 service unavail */
 				txn->status = 503;
-				stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_503));
+				http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_503));
 				if (!(s->flags & SF_ERR_MASK))
 					s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
 				goto return_prx_cond;
@@ -3005,7 +3011,7 @@
 
 		/* nothing to fail, let's reply normaly */
 		txn->status = 200;
-		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_200));
+		http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_200));
 		if (!(s->flags & SF_ERR_MASK))
 			s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
 		goto return_prx_cond;
@@ -3239,7 +3245,7 @@
 
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	txn->status = 400;
-	stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
+	http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 
 	sess->fe->fe_counters.failed_req++;
 	if (sess->listener->counters)
@@ -3561,7 +3567,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);
+			http_reply_and_close(s, txn->status, &trash);
 			stream_inc_http_err_ctr(s);
 			return HTTP_RULE_RES_ABRT;
 
@@ -4275,7 +4281,7 @@
 			memcpy(trash.str + trash.len, "\r\nConnection: close\r\n\r\n", 23);
 			trash.len += 23;
 		}
-		stream_int_retnclose(&s->si[0], &trash);
+		http_reply_and_close(s, txn->status, &trash);
 		req->chn->analysers = 0;
 	}
 
@@ -4359,7 +4365,7 @@
 		if (unlikely(!stream_int_register_handler(&s->si[1], objt_applet(s->target)))) {
 			txn->status = 500;
 			s->logs.tv_request = now;
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_500));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_RESOURCE;
@@ -4489,7 +4495,7 @@
 	txn->flags |= TX_CLDENY;
 	txn->status = http_err_codes[txn->rule_deny_status];
 	s->logs.tv_request = now;
-	stream_int_retnclose(&s->si[0], http_error_message(s, txn->rule_deny_status));
+	http_reply_and_close(s, txn->status, http_error_message(s, txn->rule_deny_status));
 	stream_inc_http_err_ctr(s);
 	sess->fe->fe_counters.denied_req++;
 	if (sess->fe != s->be)
@@ -4509,7 +4515,7 @@
 
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	txn->status = 400;
-	stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
+	http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 
 	sess->fe->fe_counters.failed_req++;
 	if (sess->listener->counters)
@@ -4581,7 +4587,7 @@
 			txn->req.msg_state = HTTP_MSG_ERROR;
 			txn->status = 500;
 			req->analysers = 0;
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_500));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_RESOURCE;
@@ -4856,7 +4862,7 @@
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	txn->status = 400;
 	req->analysers = 0;
-	stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
+	http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 
 	sess->fe->fe_counters.failed_req++;
 	if (sess->listener->counters)
@@ -4897,7 +4903,7 @@
 
 	txn->status = 500;
 	if (!(req->flags & CF_READ_ERROR))
-		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_500));
+		http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_500));
 
 	req->analysers = 0;
 	req->analyse_exp = TICK_ETERNITY;
@@ -5010,7 +5016,7 @@
 
 	if ((req->flags & CF_READ_TIMEOUT) || tick_is_expired(req->analyse_exp, now_ms)) {
 		txn->status = 408;
-		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_408));
+		http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_408));
 
 		if (!(s->flags & SF_ERR_MASK))
 			s->flags |= SF_ERR_CLITO;
@@ -5043,7 +5049,7 @@
  return_bad_req: /* let's centralize all bad requests */
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	txn->status = 400;
-	stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
+	http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 
 	if (!(s->flags & SF_ERR_MASK))
 		s->flags |= SF_ERR_PRXCOND;
@@ -5917,10 +5923,10 @@
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	if (txn->status) {
 		/* Note: we don't send any error if some data were already sent */
-		stream_int_retnclose(&s->si[0], NULL);
+		http_reply_and_close(s, txn->status, NULL);
 	} else {
 		txn->status = 400;
-		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
+		http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 	}
 	req->analysers = 0;
 	s->res.analysers = 0; /* we're in data phase, we want to abort both directions */
@@ -5939,10 +5945,10 @@
 	txn->req.msg_state = HTTP_MSG_ERROR;
 	if (txn->status) {
 		/* Note: we don't send any error if some data were already sent */
-		stream_int_retnclose(&s->si[0], NULL);
+		http_reply_and_close(s, txn->status, NULL);
 	} else {
 		txn->status = 502;
-		stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
+		http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_502));
 	}
 	req->analysers = 0;
 	s->res.analysers = 0; /* we're in data phase, we want to abort both directions */
@@ -6085,7 +6091,7 @@
 			txn->status = 502;
 			s->si[1].flags |= SI_FL_NOLINGER;
 			channel_truncate(rep);
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_502));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_PRXCOND;
@@ -6120,7 +6126,7 @@
 			txn->status = 502;
 			s->si[1].flags |= SI_FL_NOLINGER;
 			channel_truncate(rep);
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_502));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_SRVCL;
@@ -6145,7 +6151,7 @@
 			txn->status = 504;
 			s->si[1].flags |= SI_FL_NOLINGER;
 			channel_truncate(rep);
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_504));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_504));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_SRVTO;
@@ -6166,7 +6172,7 @@
 
 			txn->status = 400;
 			channel_truncate(rep);
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_400));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_CLICL;
@@ -6195,7 +6201,7 @@
 			txn->status = 502;
 			s->si[1].flags |= SI_FL_NOLINGER;
 			channel_truncate(rep);
-			stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
+			http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_502));
 
 			if (!(s->flags & SF_ERR_MASK))
 				s->flags |= SF_ERR_SRVCL;
@@ -6577,7 +6583,7 @@
 	s->logs.level = 0;
 	s->res.flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
 	channel_truncate(rep);
-	stream_int_retnclose(&s->si[0], NULL);
+	http_reply_and_close(s, txn->status, NULL);
 	return 0;
 }
 
@@ -6676,7 +6682,7 @@
 				s->logs.t_data = -1; /* was not a valid response */
 				s->si[1].flags |= SI_FL_NOLINGER;
 				channel_truncate(rep);
-				stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_502));
+				http_reply_and_close(s, txn->status, http_error_message(s, HTTP_ERR_502));
 				if (!(s->flags & SF_ERR_MASK))
 					s->flags |= SF_ERR_PRXCOND;
 				if (!(s->flags & SF_FINST_MASK))
@@ -7213,7 +7219,7 @@
 
 	txn->rsp.msg_state = HTTP_MSG_ERROR;
 	/* don't send any error message as we're in the body */
-	stream_int_retnclose(&s->si[0], NULL);
+	http_reply_and_close(s, txn->status, NULL);
 	res->analysers = 0;
 	s->req.analysers = 0; /* we're in data phase, we want to abort both directions */
 	if (objt_server(s->target))
@@ -7233,7 +7239,7 @@
 
 	txn->rsp.msg_state = HTTP_MSG_ERROR;
 	/* don't send any error message as we're in the body */
-	stream_int_retnclose(&s->si[0], NULL);
+	http_reply_and_close(s, txn->status, NULL);
 	res->analysers = 0;
 	s->req.analysers = 0; /* we're in data phase, we want to abort both directions */