summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-08-25 14:24:56 +0100
committerMatthew Sackman <matthew@lshift.net>2009-08-25 14:24:56 +0100
commitbd31855aed920230c6da5dc91c2843aaf33f4502 (patch)
tree7dc7d2259743e69c915252224fab7d07a61fc197
parent431942e4d954e090370f900653e730eb4005b141 (diff)
parent382e58f2e2f95e37ef19b9203be6e98bb1cad556 (diff)
downloadrabbitmq-server-bd31855aed920230c6da5dc91c2843aaf33f4502.tar.gz
merging in from default
-rw-r--r--docs/rabbitmq-activate-plugins.1.pod12
-rw-r--r--docs/rabbitmq-multi.1.pod32
-rw-r--r--docs/rabbitmq-server.1.pod61
-rw-r--r--docs/rabbitmq.conf.5.pod37
-rw-r--r--docs/rabbitmqctl.1.pod444
-rw-r--r--src/rabbit_control.erl48
6 files changed, 392 insertions, 242 deletions
diff --git a/docs/rabbitmq-activate-plugins.1.pod b/docs/rabbitmq-activate-plugins.1.pod
index 6bf9f6c4..58ffea79 100644
--- a/docs/rabbitmq-activate-plugins.1.pod
+++ b/docs/rabbitmq-activate-plugins.1.pod
@@ -1,6 +1,7 @@
=head1 NAME
-rabbitmq-activate-plugins - command line tool for activating plugins in a RabbitMQ broker
+rabbitmq-activate-plugins - command line tool for activating plugins
+in a RabbitMQ broker
=head1 SYNOPSIS
@@ -12,8 +13,8 @@ RabbitMQ is an implementation of AMQP, the emerging standard for high
performance enterprise messaging. The RabbitMQ server is a robust and
scalable implementation of an AMQP broker.
-rabbitmq-activate-plugins is a command line tool for activating plugins installed
-into the broker's plugins directory.
+rabbitmq-activate-plugins is a command line tool for activating
+plugins installed into the broker's plugins directory.
=head1 EXAMPLES
@@ -24,7 +25,8 @@ execute:
=head1 SEE ALSO
-rabbitmq.conf(5), rabbitmq-multi(1), rabbitmq-server(1), rabbitmqctl(1)
+L<rabbitmq.conf(5)>, L<rabbitmq-multi(1)>, L<rabbitmq-server(1)>,
+L<rabbitmqctl(1)>
=head1 AUTHOR
@@ -32,4 +34,4 @@ The RabbitMQ Team <info@rabbitmq.com>
=head1 REFERENCES
-RabbitMQ Web Site: http://www.rabbitmq.com
+RabbitMQ Web Site: L<http://www.rabbitmq.com>
diff --git a/docs/rabbitmq-multi.1.pod b/docs/rabbitmq-multi.1.pod
index 63848756..640609ee 100644
--- a/docs/rabbitmq-multi.1.pod
+++ b/docs/rabbitmq-multi.1.pod
@@ -15,22 +15,30 @@ scalable implementation of an AMQP broker.
rabbitmq-multi scripts allows for easy set-up of a cluster on a single
machine.
-See also rabbitmq-server(1) for configuration information.
+See also L<rabbitmq-server(1)> for configuration information.
=head1 COMMANDS
-start_all I<count>
- start count nodes with unique names, listening on all IP addresses
-and on sequential ports starting from 5672.
+=over
-status
- print the status of all running RabbitMQ nodes
+=item start_all I<count>
-stop_all
- stop all local RabbitMQ nodes
+Start count nodes with unique names, listening on all IP addresses and
+on sequential ports starting from 5672.
-rotate_logs
- rotate log files for all local and running RabbitMQ nodes
+=item status
+
+Print the status of all running RabbitMQ nodes.
+
+=item stop_all
+
+Stop all local RabbitMQ nodes,
+
+=item rotate_logs
+
+Rotate log files for all local and running RabbitMQ nodes.
+
+=back
=head1 EXAMPLES
@@ -40,7 +48,7 @@ Start 3 local RabbitMQ nodes with unique, sequential port numbers:
=head1 SEE ALSO
-rabbitmq.conf(5), rabbitmq-server(1), rabbitmqctl(1)
+L<rabbitmq.conf(5)>, L<rabbitmq-server(1)>, L<rabbitmqctl(1)>
=head1 AUTHOR
@@ -48,4 +56,4 @@ The RabbitMQ Team <info@rabbitmq.com>
=head1 REFERENCES
-RabbitMQ Web Site: http://www.rabbitmq.com
+RabbitMQ Web Site: L<http://www.rabbitmq.com>
diff --git a/docs/rabbitmq-server.1.pod b/docs/rabbitmq-server.1.pod
index 04062b1a..d74ab8d9 100644
--- a/docs/rabbitmq-server.1.pod
+++ b/docs/rabbitmq-server.1.pod
@@ -16,41 +16,57 @@ Running rabbitmq-server in the foreground displays a banner message,
and reports on progress in the startup sequence, concluding with the
message "broker running", indicating that the RabbitMQ broker has been
started successfully. To shut down the server, just terminate the
-process or use rabbitmqctl(1).
+process or use L<rabbitmqctl(1)>.
=head1 ENVIRONMENT
-B<RABBITMQ_MNESIA_BASE>
- Defaults to /var/lib/rabbitmq/mnesia. Set this to the directory
-where Mnesia database files should be placed.
+=over
-B<RABBITMQ_LOG_BASE>
- Defaults to /var/log/rabbitmq. Log files generated by the server
-will be placed in this directory.
+=item B<RABBITMQ_MNESIA_BASE>
-B<RABBITMQ_NODENAME>
- Defaults to rabbit. This can be useful if you want to run more
-than one node per machine - B<RABBITMQ_NODENAME> should be unique per
+Defaults to F</var/lib/rabbitmq/mnesia>. Set this to the directory where
+Mnesia database files should be placed.
+
+=item B<RABBITMQ_LOG_BASE>
+
+Defaults to F</var/log/rabbitmq>. Log files generated by the server will
+be placed in this directory.
+
+=item B<RABBITMQ_NODENAME>
+
+Defaults to rabbit. This can be useful if you want to run more than
+one node per machine - B<RABBITMQ_NODENAME> should be unique per
erlang-node-and-machine combination. See clustering on a single
machine guide at
-http://www.rabbitmq.com/clustering.html#single-machine for details.
+L<http://www.rabbitmq.com/clustering.html#single-machine> for details.
+
+=item B<RABBITMQ_NODE_IP_ADDRESS>
+
+Defaults to 0.0.0.0. This can be changed if you only want to bind to
+one network interface.
-B<RABBITMQ_NODE_IP_ADDRESS>
- Defaults to 0.0.0.0. This can be changed if you only want to bind
-to one network interface.
+=item B<RABBITMQ_NODE_PORT>
-B<RABBITMQ_NODE_PORT>
- Defaults to 5672.
+Defaults to 5672.
-B<RABBITMQ_CLUSTER_CONFIG_FILE>
- Defaults to /etc/rabbitmq/rabbitmq_cluster.config. If this file is
+=item B<RABBITMQ_CLUSTER_CONFIG_FILE>
+
+Defaults to F</etc/rabbitmq/rabbitmq_cluster.config>. If this file is
present it is used by the server to auto-configure a RabbitMQ cluster.
-See the clustering guide at http://www.rabbitmq.com/clustering.html
+See the clustering guide at L<http://www.rabbitmq.com/clustering.html>
for details.
+=back
+
=head1 OPTIONS
-B<-detached> start the server process in the background
+=over
+
+=item B<-detached>
+
+start the server process in the background
+
+=back
=head1 EXAMPLES
@@ -60,7 +76,7 @@ Run RabbitMQ AMQP server in the background:
=head1 SEE ALSO
-rabbitmq.conf(5), rabbitmq-multi(1), rabbitmqctl(1)
+L<rabbitmq.conf(5)>, L<rabbitmq-multi(1)>, L<rabbitmqctl(1)>
=head1 AUTHOR
@@ -68,4 +84,5 @@ The RabbitMQ Team <info@rabbitmq.com>
=head1 REFERENCES
-RabbitMQ Web Site: http://www.rabbitmq.com
+RabbitMQ Web Site: L<http://www.rabbitmq.com>
+
diff --git a/docs/rabbitmq.conf.5.pod b/docs/rabbitmq.conf.5.pod
index 4d522163..a7bf4c09 100644
--- a/docs/rabbitmq.conf.5.pod
+++ b/docs/rabbitmq.conf.5.pod
@@ -1,10 +1,11 @@
=head1 NAME
-/etc/rabbitmq/rabbitmq.conf - default settings for RabbitMQ AMQP server
+F</etc/rabbitmq/rabbitmq.conf> - default settings for RabbitMQ AMQP
+server
=head1 DESCRIPTION
-/etc/rabbitmq/rabbitmq.conf contains variable settings that override the
+F</etc/rabbitmq/rabbitmq.conf> contains variable settings that override the
defaults built in to the RabbitMQ startup scripts.
The file is interpreted by the system shell, and so should consist of
@@ -13,27 +14,35 @@ syntax is permitted (since the file is sourced using the shell "."
operator), including line comments starting with "#".
In order of preference, the startup scripts get their values from the
-environment, from /etc/rabbitmq/rabbitmq.conf and finally from the
-built-in default values. For example, for the B<RABBITMQ_NODENAME> setting,
+environment, from F</etc/rabbitmq/rabbitmq.conf> and finally from the
+built-in default values. For example, for the B<RABBITMQ_NODENAME>
+setting,
-B<RABBITMQ_NODENAME>
- from the environment is checked first. If it is absent or equal to
-the empty string, then
+=over
-B<NODENAME>
- from /etc/rabbitmq/rabbitmq.conf is checked. If it is also absent
+=item B<RABBITMQ_NODENAME>
+
+from the environment is checked first. If it is absent or equal to the
+empty string, then
+
+=item B<NODENAME>
+
+from L</etc/rabbitmq/rabbitmq.conf> is checked. If it is also absent
or set equal to the empty string then the default value from the
startup script is used.
The variable names in /etc/rabbitmq/rabbitmq.conf are always equal to the
environment variable names, with the B<RABBITMQ_> prefix removed:
B<RABBITMQ_NODE_PORT> from the environment becomes B<NODE_PORT> in the
-/etc/rabbitmq/rabbitmq.conf file, etc.
+F</etc/rabbitmq/rabbitmq.conf> file, etc.
+
+=back
=head1 EXAMPLES
-The following is an example of a complete /etc/rabbitmq/rabbitmq.conf file
-that overrides the default Erlang node name from "rabbit" to "hare":
+The following is an example of a complete
+F</etc/rabbitmq/rabbitmq.conf> file that overrides the default Erlang
+node name from "rabbit" to "hare":
# I am a complete /etc/rabbitmq/rabbitmq.conf file.
# Comment lines start with a hash character.
@@ -42,7 +51,7 @@ that overrides the default Erlang node name from "rabbit" to "hare":
=head1 SEE ALSO
-rabbitmq-server(1), rabbitmq-multi(1), rabbitmqctl(1)
+L<rabbitmq-server(1)>, L<rabbitmq-multi(1)>, L<rabbitmqctl(1)>
=head1 AUTHOR
@@ -57,4 +66,4 @@ info@rabbitmq.com.
=head1 REFERENCES
-RabbitMQ Web Site: http://www.rabbitmq.com
+RabbitMQ Web Site: L<http://www.rabbitmq.com>
diff --git a/docs/rabbitmqctl.1.pod b/docs/rabbitmqctl.1.pod
index 58fbb100..6d4aadeb 100644
--- a/docs/rabbitmqctl.1.pod
+++ b/docs/rabbitmqctl.1.pod
@@ -18,58 +18,69 @@ It performs all actions by connecting to one of the broker's nodes.
=head1 OPTIONS
-B<-n> I<node>
- default node is C<rabbit@server>, where server is the local host.
-On a host named C<server.example.com>, the node name of the RabbitMQ
+=over
+
+=item B<-n> I<node>
+
+Default node is C<rabbit@server>, where server is the local host. On
+a host named C<server.example.com>, the node name of the RabbitMQ
Erlang node will usually be rabbit@server (unless RABBITMQ_NODENAME
has been set to some non-default value at broker startup time). The
output of hostname -s is usually the correct suffix to use after the
"@" sign. See rabbitmq-server(1) for details of configuring the
RabbitMQ broker.
-B<-q>
- quiet output mode is selected with the B<-q> flag. Informational
+=item B<-q>
+
+Quiet output mode is selected with the B<-q> flag. Informational
messages are suppressed when quiet mode is in effect.
+=back
+
=head1 COMMANDS
=head2 APPLICATION AND CLUSTER MANAGEMENT
-stop
- stop the Erlang node on which RabbitMQ broker is running.
-
-stop_app
- stop the RabbitMQ application, leaving the Erlang node running.
-This command is typically run prior to performing other management
-actions that require the RabbitMQ application to be stopped,
-e.g. I<reset>.
-
-start_app
- start the RabbitMQ application.
- This command is typically run prior to performing other management
-actions that require the RabbitMQ application to be stopped,
-e.g. I<reset>.
-
-status
- display various information about the RabbitMQ broker, such as
-whether the RabbitMQ application on the current node, its version
-number, what nodes are part of the broker, which of these are running.
-
-reset
- return a RabbitMQ node to its virgin state.
- Removes the node from any cluster it belongs to, removes all data
-from the management database, such as configured users, vhosts and
-deletes all persistent messages.
-
-force_reset
- the same as I<reset> command, but resets the node unconditionally,
+=over
+
+=item stop
+
+Stop the Erlang node on which RabbitMQ broker is running.
+
+=item stop_app
+
+Stop the RabbitMQ application, leaving the Erlang node running. This
+command is typically run prior to performing other management actions
+that require the RabbitMQ application to be stopped, e.g. I<reset>.
+
+=item start_app
+
+Start the RabbitMQ application. This command is typically run prior
+to performing other management actions that require the RabbitMQ
+application to be stopped, e.g. I<reset>.
+
+=item status
+
+Display various information about the RabbitMQ broker, such as whether
+the RabbitMQ application on the current node, its version number, what
+nodes are part of the broker, which of these are running.
+
+=item reset
+
+Return a RabbitMQ node to its virgin state. Removes the node from any
+cluster it belongs to, removes all data from the management database,
+such as configured users, vhosts and deletes all persistent messages.
+
+=item force_reset
+
+The same as I<reset> command, but resets the node unconditionally,
regardless of the current management database state and cluster
-configuration.
- It should only be used as a last resort if the database or cluster
-configuration has been corrupted.
+configuration. It should only be used as a last resort if the
+database or cluster configuration has been corrupted.
+
+=item rotate_logs [suffix]
-rotate_logs [suffix]
- instruct the RabbitMQ node to rotate the log files. The RabbitMQ
+Instruct the RabbitMQ node to rotate the log files. The RabbitMQ
broker will attempt to append the current contents of the log file to
the file with the name composed of the original name and the
suffix. It will create a new file if such a file does not already
@@ -77,207 +88,318 @@ exist. When no I<suffix> is specified, the empty log file is simply
created at the original location; no rotation takes place. When an
error occurs while appending the contents of the old log file, the
operation behaves in the same way as if no I<suffix> was specified.
- This command might be helpful when you are e.g. writing your own
+This command might be helpful when you are e.g. writing your own
logrotate script and you do not want to restart the RabbitMQ node.
-cluster I<clusternode> ...
- instruct the node to become member of a cluster with the specified
+=item cluster I<clusternode> ...
+
+Instruct the node to become member of a cluster with the specified
nodes determined by I<clusternode> option(s). See
-http://www.rabbitmq.com/clustering.html for more information about
+L<http://www.rabbitmq.com/clustering.html> for more information about
clustering.
+=back
+
=head2 USER MANAGEMENT
-add_user I<username> I<password>
- create a user named I<username> with (initial) password I<password>.
+=over
+
+=item add_user I<username> I<password>
+
+Create a user named I<username> with (initial) password I<password>.
+
+=item delete_user I<username>
+
+Delete the user named I<username>.
-delete_user I<username>
- delete the user named I<username>.
+=item change_password I<username> I<newpassword>
-change_password I<username> I<newpassword>
- change the password for the user named I<username> to I<newpassword>.
+Change the password for the user named I<username> to I<newpassword>.
-list_users
- list all users.
+=item list_users
+
+List all users, one per line.
+
+=back
=head2 ACCESS CONTROL
-add_vhost I<vhostpath>
- create a new virtual host called I<vhostpath>.
+=over
+
+=item add_vhost I<vhostpath>
+
+Create a new virtual host called I<vhostpath>.
+
+=item delete_vhost I<vhostpath>
-delete_vhost I<vhostpath>
- delete a virtual host I<vhostpath>.
- That command deletes also all its exchanges, queues and user
-mappings.
-
-list_vhosts
- list all virtual hosts.
+Delete a virtual host I<vhostpath>. This command deletes also all its
+exchanges, queues and user mappings.
-set_permissions [-p I<vhostpath>] I<username> I<regexp> I<regexp> I<regexp>
- set the permissions for the user named I<username> in the virtual
-host I<vhostpath>, granting 'configure', 'write' and 'read' access to
+=item list_vhosts
+
+List all virtual hosts, one per line.
+
+=item set_permissions [-p I<vhostpath>] I<username> I<regexp> I<regexp> I<regexp>
+
+Set the permissions for the user named I<username> in the virtual host
+I<vhostpath>, granting I<configure>, I<write> and I<read> access to
resources with names matching the first, second and third I<regexp>,
respectively.
-clear_permissions [-p I<vhostpath>] I<username>
- remove the permissions for the user named I<username> in the
-virtual host I<vhostpath>.
+=item clear_permissions [-p I<vhostpath>] I<username>
+
+Remove the permissions for the user named I<username> in the virtual
+host I<vhostpath>.
+
+=item list_permissions [-p I<vhostpath>]
+
+List all the users and their permissions in the virtual host
+I<vhostpath>. Each output line contains the username and their
+I<configure>, I<write> and I<read> access regexps, separated by tab
+characters.
-list_permissions [-p I<vhostpath>]
- list all the users and their permissions in the virtual host
-I<vhostpath>.
+=item list_user_permissions I<username>
-list_user_permissions I<username>
- list the permissions of the user named I<username> across all
-virtual hosts.
+List the permissions of the user named I<username> across all virtual
+hosts.
+
+=back
=head2 SERVER STATUS
-list_queues [-p I<vhostpath>] [I<queueinfoitem> ...]
- list queue information by virtual host. If no I<queueinfoitem>s
-are specified then then name and number of messages is displayed for
-each queue.
+=over
+
+=item list_queues [-p I<vhostpath>] [I<queueinfoitem> ...]
+
+List queue information by virtual host. Each line printed
+describes a queue, with the requested I<queueinfoitem> values
+separated by tab characters. If no I<queueinfoitem>s are
+specified then I<name> and I<messages> are assumed.
+
+=back
=head3 Queue information items
-=over 4
+=over
+
+=item name
+
+name of the queue
+
+=item durable
+
+whether the queue survives server restarts
+
+=item auto_delete
+
+whether the queue will be deleted when no longer used
-name
- URL-encoded name of the queue
+=item arguments
-durable
- whether the queue survives server restarts
+queue arguments
-auto_delete
- whether the queue will be deleted when no longer used
+=item node
-arguments
- queue arguments
+node on which the process associated with the queue resides
-node
- node on which the process associated with the queue resides
+=item messages_ready
-messages_ready
- number of messages ready to be delivered to clients
+number of messages ready to be delivered to clients
-messages_unacknowledged
- number of messages delivered to clients but not yet acknowledged
+=item messages_unacknowledged
-messages_uncommitted
- number of messages published in as yet uncommitted transactions
+number of messages delivered to clients but not yet acknowledged
-messages
- sum of ready, unacknowledged and uncommitted messages
+=item messages_uncommitted
-acks_uncommitted
- number of acknowledgements received in as yet uncommitted
-transactions
+number of messages published in as yet uncommitted transactions
-consumers
- number of consumers
+=item messages
-transactions
- number of transactions
+sum of ready, unacknowledged and uncommitted messages
-memory
- bytes of memory consumed by the Erlang process for the queue,
+=item acks_uncommitted
+
+number of acknowledgements received in as yet uncommitted transactions
+
+=item consumers
+
+number of consumers
+
+=item transactions
+
+number of transactions
+
+=item memory
+
+bytes of memory consumed by the Erlang process for the queue,
including stack, heap and internal structures
=back
-list_exchanges [-p I<vhostpath>] [I<exchangeinfoitem> ...]
- list exchange information by virtual host. If no
-I<exchangeinfoitem>s are specified then name and type is displayed for
-each exchange.
+=over
+
+=item list_exchanges [-p I<vhostpath>] [I<exchangeinfoitem> ...]
+
+List queue information by virtual host. Each line printed describes an
+exchange, with the requested I<exchangeinfoitem> values separated by
+tab characters. If no I<exchangeinfoitem>s are specified then I<name>
+and I<type> are assumed.
+
+=back
=head3 Exchange information items
-=over 4
+=over
+
+=item name
-name
- URL-encoded name of the exchange
+name of the exchange
-type
- exchange type (B<direct>, B<topic>, B<fanout>, or B<headers>)
+=item type
-durable
- whether the exchange survives server restarts
+exchange type (B<direct>, B<topic>, B<fanout>, or B<headers>)
-auto_delete
- whether the exchange is deleted when no longer used
+=item durable
-arguments
- exchange arguments
+whether the exchange survives server restarts
+
+=item auto_delete
+
+whether the exchange is deleted when no longer used
+
+=item arguments
+
+exchange arguments
=back
-list_bindings [-p I<vhostpath>]
- list bindings by virtual host. Each line contains exchange name,
-routing key and queue name (all URL encoded) and arguments.
+=over
+
+=item list_bindings [-p I<vhostpath>]
+
+List bindings by virtual host. Each line printed describes a binding,
+with the exchange name, routing key, queue name and arguments,
+separated by tab characters.
-list_connections [I<connectioninfoitem> ...]
- list connection information. If no I<connectioninfoitem>s are
-specified then the user, peer address and peer port are displayed.
+=item list_connections [I<connectioninfoitem> ...]
+
+List queue information by virtual host. Each line printed describes an
+connection, with the requested I<connectioninfoitem> values separated
+by tab characters. If no I<connectioninfoitem>s are specified then
+I<user>, I<peer_address> and I<peer_port> are assumed.
+
+=back
=head3 Connection information items
-=over 4
+=over
+
+=item node
+
+node on which the process associated with the connection resides
+
+=item address
-node
- node on which the process associated with the connection resides
+server IP number
-address
- server IP number
+=item port
-port
- server port
+server port
-peer_address
- peer address
+=item peer_address
-peer_port
- peer port
+peer address
-state
- connection state (B<pre-init>, B<starting>, B<tuning>, B<opening>,
+=item peer_port
+
+peer port
+
+=item state
+
+connection state (B<pre-init>, B<starting>, B<tuning>, B<opening>,
B<running>, B<closing>, B<closed>)
-channels
- number of channels using the connection
+=item channels
+
+number of channels using the connection
+
+=item user
+
+username associated with the connection
+
+=item vhost
+
+virtual host
+
+=item timeout
+
+connection timeout
+
+=item frame_max
+
+maximum frame size (bytes)
-user
- username associated with the connection
+=item recv_oct
-vhost
- URL-encoded virtual host
+octets received
-timeout
- connection timeout
+=item recv_cnt
-frame_max
- maximum frame size (bytes)
+packets received
-recv_oct
- octets received
+=item send_oct
-recv_cnt
- packets received
+octets sent
-send_oct
- octets sent
+=item send_cnt
-send_cnt
- packets sent
+packets sent
-send_pend
- send queue size
+=item send_pend
+
+send queue size
=back
The list_queues, list_exchanges and list_bindings commands accept an
-optional virtual host parameter for which to display results, defaulting
-to I<"/">. The default can be overridden with the B<-p> flag. Result
-columns for these commands and list_connections are tab-separated.
+optional virtual host parameter for which to display results,
+defaulting to I<"/">. The default can be overridden with the B<-p>
+flag.
+
+=head1 OUTPUT ESCAPING
+
+Various items that may appear in the output of rabbitmqctl can contain
+arbitrary octets. If a octet corresponds to a non-printing ASCII
+character (values 0 to 31, and 127), it will be escaped in the output,
+using a sequence consisting of a backslash character followed by three
+octal digits giving the octet's value (i.e., as used in string
+literals in the C programming language). An octet corresponding to
+the backslash character (i.e. with value 92) will be escaped using a
+sequence of two backslash characters. Octets with a value of 128 or
+above are not escaped, in order to preserve strings encoded with
+UTF-8.
+
+The items to which this escaping scheme applies are:
+
+=over
+
+=item *
+Usernames
+
+=item *
+Virtual host names
+
+=item *
+Queue names
+
+=item *
+Exchange names
+
+=item *
+Regular expressions used for access control
+
+=back
=head1 EXAMPLES
@@ -306,4 +428,4 @@ The RabbitMQ Team <info@rabbitmq.com>
=head1 REFERENCES
-RabbitMQ Web Site: http://www.rabbitmq.com
+RabbitMQ Web Site: L<http://www.rabbitmq.com>
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index 37e4d189..cf20520e 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -329,22 +329,23 @@ format_info_item(Items, Key) ->
{value, Info = {Key, Value}} = lists:keysearch(Key, 1, Items),
case Info of
{_, #resource{name = Name}} ->
- url_encode(Name);
+ escape(Name);
_ when Key =:= address; Key =:= peer_address andalso is_tuple(Value) ->
inet_parse:ntoa(Value);
_ when is_pid(Value) ->
atom_to_list(node(Value));
_ when is_binary(Value) ->
- url_encode(Value);
+ escape(Value);
_ ->
io_lib:format("~w", [Value])
end.
display_list(L) when is_list(L) ->
lists:foreach(fun (I) when is_binary(I) ->
- io:format("~s~n", [url_encode(I)]);
+ io:format("~s~n", [escape(I)]);
(I) when is_tuple(I) ->
- display_row([url_encode(V) || V <- tuple_to_list(I)])
+ display_row([escape(V)
+ || V <- tuple_to_list(I)])
end,
lists:sort(L)),
ok;
@@ -356,32 +357,23 @@ call(Node, {Mod, Fun, Args}) ->
rpc_call(Node, Mod, Fun, Args) ->
rpc:call(Node, Mod, Fun, Args, ?RPC_TIMEOUT).
-%% url_encode is lifted from ibrowse, modified to preserve some characters
-url_encode(Bin) when binary(Bin) ->
- url_encode_char(lists:reverse(binary_to_list(Bin)), []).
-
-url_encode_char([X | T], Acc) when X >= $a, X =< $z ->
- url_encode_char(T, [X | Acc]);
-url_encode_char([X | T], Acc) when X >= $A, X =< $Z ->
- url_encode_char(T, [X | Acc]);
-url_encode_char([X | T], Acc) when X >= $0, X =< $9 ->
- url_encode_char(T, [X | Acc]);
-url_encode_char([X | T], Acc)
- when X == $-; X == $_; X == $.; X == $~;
- X == $!; X == $*; X == $'; X == $(;
- X == $); X == $;; X == $:; X == $@;
- X == $&; X == $=; X == $+; X == $$;
- X == $,; X == $/; X == $?; X == $%;
- X == $#; X == $[; X == $] ->
- url_encode_char(T, [X | Acc]);
-url_encode_char([X | T], Acc) ->
- url_encode_char(T, [$%, d2h(X bsr 4), d2h(X band 16#0f) | Acc]);
-url_encode_char([], Acc) ->
+%% escape does C-style backslash escaping of non-printable ASCII
+%% characters. We don't escape characters above 127, since they may
+%% form part of UTF-8 strings.
+
+escape(Bin) when binary(Bin) ->
+ escape_char(lists:reverse(binary_to_list(Bin)), []).
+
+escape_char([$\\ | T], Acc) ->
+ escape_char(T, [$\\, $\\ | Acc]);
+escape_char([X | T], Acc) when X > 32, X /= 127 ->
+ escape_char(T, [X | Acc]);
+escape_char([X | T], Acc) ->
+ escape_char(T, [$\\, $0 + (X bsr 6), $0 + (X band 8#070 bsr 3),
+ $0 + (X band 7) | Acc]);
+escape_char([], Acc) ->
Acc.
-d2h(N) when N<10 -> N+$0;
-d2h(N) -> N+$a-10.
-
list_replace(Find, Replace, List) ->
[case X of Find -> Replace; _ -> X end || X <- List].