[MINOR] replace client_retnclose() with stream_int_retnclose()

This makes more sense to return a message to a stream interface
than to a session.

senddata.{c,h} have been removed.
diff --git a/src/client.c b/src/client.c
index 8e8dc53..bc7b254 100644
--- a/src/client.c
+++ b/src/client.c
@@ -34,6 +34,7 @@
 #include <proto/hdr_idx.h>
 #include <proto/proto_http.h>
 #include <proto/session.h>
+#include <proto/stream_interface.h>
 #include <proto/stream_sock.h>
 #include <proto/task.h>
 
@@ -411,13 +412,13 @@
 			 * both cases, we return a fake "HTTP/1.0 200 OK" response and we exit.
 			 */
 			struct chunk msg = { .str = "HTTP/1.0 200 OK\r\n\r\n", .len = 19 };
-			client_retnclose(s, &msg); /* forge a 200 response */
+			stream_int_retnclose(&s->si[0], &msg); /* forge a 200 response */
 			trace_term(s, TT_CLIENT_1);
 			t->expire = s->rep->wex;
 		}
 		else if (p->mode == PR_MODE_HEALTH) {  /* health check mode, no client reading */
 			struct chunk msg = { .str = "OK\n", .len = 3 };
-			client_retnclose(s, &msg); /* forge an "OK" response */
+			stream_int_retnclose(&s->si[0], &msg); /* forge an "OK" response */
 			trace_term(s, TT_CLIENT_2);
 			t->expire = s->rep->wex;
 		}
diff --git a/src/dumpstats.c b/src/dumpstats.c
index e4ef0b6..c0abe9f 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -42,9 +42,9 @@
 #include <proto/dumpstats.h>
 #include <proto/fd.h>
 #include <proto/proto_uxst.h>
-#include <proto/senddata.h>
 #include <proto/session.h>
 #include <proto/server.h>
+#include <proto/stream_interface.h>
 
 /* This function parses a "stats" statement in the "global" section. It returns
  * -1 if there is any error, otherwise zero. If it returns -1, it may write an
@@ -197,7 +197,7 @@
 		/* the function had not been called yet, let's prepare the
 		 * buffer for a response.
 		 */
-		client_retnclose(s, &msg);
+		stream_int_retnclose(rep->cons, &msg);
 		s->data_state = DATA_ST_HEAD;
 		/* fall through */
 
@@ -326,7 +326,7 @@
 		chunk_printf(&msg, sizeof(trash), "\r\n");
 
 		s->txn.status = 200;
-		client_retnclose(s, &msg); // send the start of the response.
+		stream_int_retnclose(rep->cons, &msg); // send the start of the response.
 		msg.len = 0;
 
 		if (!(s->flags & SN_ERR_MASK))  // this is not really an error but it is
diff --git a/src/proto_http.c b/src/proto_http.c
index e321641..b8e4daa 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -48,7 +48,6 @@
 #include <proto/proto_tcp.h>
 #include <proto/proto_http.h>
 #include <proto/queue.h>
-#include <proto/senddata.h>
 #include <proto/session.h>
 #include <proto/stream_interface.h>
 #include <proto/stream_sock.h>
@@ -1762,7 +1761,7 @@
 			else if (req->flags & BF_READ_TIMEOUT || tick_is_expired(req->analyse_exp, now_ms)) {
 				/* read timeout : give up with an error message. */
 				txn->status = 408;
-				client_retnclose(t, error_message(t, HTTP_ERR_408));
+				stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_408));
 				msg->msg_state = HTTP_MSG_ERROR;
 				req->analysers = 0;
 				t->fe->failed_req++;
@@ -1776,7 +1775,7 @@
 			/* 4: have we encountered a close ? */
 			else if (req->flags & BF_SHUTR) {
 				txn->status = 400;
-				client_retnclose(t, error_message(t, HTTP_ERR_400));
+				stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_400));
 				msg->msg_state = HTTP_MSG_ERROR;
 				req->analysers = 0;
 				t->fe->failed_req++;
@@ -1848,14 +1847,14 @@
 				if (ret) {
 					/* we fail this request, let's return 503 service unavail */
 					txn->status = 503;
-					client_retnclose(t, error_message(t, HTTP_ERR_503));
+					stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_503));
 					goto return_prx_cond;
 				}
 			}
 
 			/* nothing to fail, let's reply normaly */
 			txn->status = 200;
-			client_retnclose(t, &http_200_chunk);
+			stream_int_retnclose(req->prod, &http_200_chunk);
 			goto return_prx_cond;
 		}
 
@@ -2026,7 +2025,7 @@
 					txn->status = rule->code;
 					/* let's log the request time */
 					t->logs.tv_request = now;
-					client_retnclose(t, &rdr);
+					stream_int_retnclose(req->prod, &rdr);
 					goto return_prx_cond;
 				}
 			}
@@ -2043,7 +2042,7 @@
 					txn->status = 403;
 					/* let's log the request time */
 					t->logs.tv_request = now;
-					client_retnclose(t, error_message(t, HTTP_ERR_403));
+					stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_403));
 					goto return_prx_cond;
 				}
 			}
@@ -2072,7 +2071,7 @@
 				txn->status = 403;
 				/* let's log the request time */
 				t->logs.tv_request = now;
-				client_retnclose(t, error_message(t, HTTP_ERR_403));
+				stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_403));
 				goto return_prx_cond;
 			}
 
@@ -2440,7 +2439,7 @@
 		txn->req.msg_state = HTTP_MSG_ERROR;
 		txn->status = 400;
 		req->analysers = 0;
-		client_retnclose(t, error_message(t, HTTP_ERR_400));
+		stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_400));
 		t->fe->failed_req++;
 	return_prx_cond:
 		if (!(t->flags & SN_ERR_MASK))
@@ -2475,7 +2474,7 @@
 
 		txn->status = 500;
 		if (req->flags != BF_READ_ERROR)
-			client_retnclose(t, error_message(t, HTTP_ERR_500));
+			stream_int_retnclose(req->prod, error_message(t, HTTP_ERR_500));
 
 		req->analysers = 0;
 		req->analyse_exp = TICK_ETERNITY;
@@ -3107,7 +3106,7 @@
 
 	/* unknown data source or internal error */
 	s->txn.status = 500;
-	client_retnclose(s, error_message(s, HTTP_ERR_500));
+	stream_int_retnclose(s->rep->cons, error_message(s, HTTP_ERR_500));
 	trace_term(s, TT_HTTP_CNT_1);
 	if (!(s->flags & SN_ERR_MASK))
 		s->flags |= SN_ERR_PRXCOND;
@@ -4475,7 +4474,7 @@
 		msg.str = trash;
 		msg.len = sprintf(trash, HTTP_401_fmt, uri_auth->auth_realm);
 		txn->status = 401;
-		client_retnclose(t, &msg);
+		stream_int_retnclose(t->req->prod, &msg);
 		trace_term(t, TT_HTTP_URI_1);
 		t->req->analysers = 0;
 		if (!(t->flags & SN_ERR_MASK))
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 32c4994..adc32d1 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -45,7 +45,6 @@
 #include <proto/proto_tcp.h>
 #include <proto/proxy.h>
 #include <proto/queue.h>
-#include <proto/senddata.h>
 #include <proto/session.h>
 #include <proto/stream_sock.h>
 #include <proto/task.h>
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index ee684a6..4b0cd9e 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -47,7 +47,6 @@
 #include <proto/protocols.h>
 #include <proto/proto_uxst.h>
 #include <proto/queue.h>
-#include <proto/senddata.h>
 #include <proto/session.h>
 #include <proto/stream_sock.h>
 #include <proto/task.h>
diff --git a/src/senddata.c b/src/senddata.c
deleted file mode 100644
index fd1d838..0000000
--- a/src/senddata.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Helper functions to send data over a socket and buffer.
- * Should probably move somewhere else, but where ?
- *
- * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <common/compat.h>
-#include <common/config.h>
-#include <common/debug.h>
-#include <common/memory.h>
-#include <common/standard.h>
-#include <common/ticks.h>
-#include <common/time.h>
-#include <common/version.h>
-
-#include <proto/backend.h>
-#include <proto/buffers.h>
-#include <proto/fd.h>
-#include <proto/senddata.h>
-#include <proto/session.h>
-
-/*
- * returns a message to the client ; the connection is shut down for read,
- * and the request is cleared so that no server connection can be initiated.
- * The client must be in a valid state for this (HEADER, DATA ...).
- * Nothing is performed on the server side. The message is contained in a
- * "chunk". If it is null, then an empty message is used.
- * The reply buffer doesn't need to be empty before this.
- */
-void client_retnclose(struct session *s, const struct chunk *msg)
-{
-	//FIXME: must move to lower level
-	//EV_FD_CLR(s->cli_fd, DIR_RD);
-	//EV_FD_SET(s->cli_fd, DIR_WR);
-	buffer_abort(s->req);
-
-	s->cli_state = CL_STSHUTR; // FIXME: still used by unix sockets
-	buffer_flush(s->rep);
-	buffer_shutr_now(s->rep);
-	if (msg && msg->len)
-		buffer_write(s->rep, msg->str, msg->len);
-
-	s->rep->wex = tick_add_ifset(now_ms, s->rep->wto);
-	buffer_write_ena(s->rep);
-}
-
-/*
- * Local variables:
- *  c-indent-level: 8
- *  c-basic-offset: 8
- * End:
- */
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 9608790..c7f9b43 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -72,6 +72,27 @@
 }
 
 /*
+ * Returns a message to the client ; the connection is shut down for read,
+ * and the request is cleared so that no server connection can be initiated.
+ * The buffer is marked for read shutdown on the other side to protect the
+ * message, and the buffer write is enabled. The message is contained in a
+ * "chunk". If it is null, then an empty message is used. The reply buffer
+ * doesn't need to be empty before this. The goal of this function is to
+ * return error messages to a client.
+ */
+void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
+{
+	buffer_abort(si->ib);
+	buffer_flush(si->ob);
+	buffer_shutr_now(si->ob);
+	if (msg && msg->len)
+		buffer_write(si->ob, msg->str, msg->len);
+
+	si->ob->wex = tick_add_ifset(now_ms, si->ob->wto);
+	buffer_write_ena(si->ob);
+}
+
+/*
  * Local variables:
  *  c-indent-level: 8
  *  c-basic-offset: 8