summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2009-07-26 18:16:43 +0200
committerWilly Tarreau <w@1wt.eu>2009-07-26 18:18:59 +0200
commit90a6c0f1ac19cd6c1dd86380ca79336e9d10ab98 (patch)
tree01e1caa9f059138c964bdcc4bf0be4bdcbf3ace0 /src
parentb98fd681793db08df3217163554c15cbacec216e (diff)
downloadhaproxy-90a6c0f1ac19cd6c1dd86380ca79336e9d10ab98.tar.gz
[MINOR] print usage on the stats sockets upon invalid commands
When issuing commands on the unix socket, there's no way to know if the result is empty or if the command is wrong. This patch makes invalid command return a help message. (cherry picked from commit 43e0e3997870e39b78b87d3050f260571e5a7de9)
Diffstat (limited to 'src')
-rw-r--r--src/proto_uxst.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 8af3d5a63..b4685d596 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -78,6 +78,18 @@ static struct protocol proto_unix = {
.nb_listeners = 0,
};
+const char unix_sock_usage_msg[] =
+ "Unknown command. Please enter one of the following commands only :\n"
+ " show info : report information about the running process\n"
+ " show stat : report counters for each proxy and server\n"
+ " show errors : report last request and response errors for each proxy\n"
+ " show sess : report the list of current sessions\n"
+ "\n";
+
+const struct chunk unix_sock_usage = {
+ .str = (char *)&unix_sock_usage_msg,
+ .len = sizeof(unix_sock_usage_msg)-1
+};
/********************************
* 1) low-level socket functions
@@ -666,7 +678,7 @@ int uxst_req_analyser_stats(struct session *s, struct buffer *req)
*p = '\0';
if (!unix_sock_parse_request(s, line)) {
/* invalid request */
- buffer_shutw_now(s->rep);
+ stream_int_retnclose(s->req->prod, &unix_sock_usage);
s->ana_state = 0;
req->analysers = 0;
return 0;