<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:lighttpd.net:lighttpd2/doc1">
	<short>limits outgoing bandwidth usage</short>

	<description><markdown>
		All rates are in bytes/sec. The magazines are filled up in fixed intervals (compile time constant; defaults to 200ms).
	</markdown></description>

	<action name="io.throttle">
		<short>set the outgoing throttle limits for current connection</short>
		<parameter name="rate">
			<short>bytes/sec limit</short>
		</parameter>
		<parameter name="burst">
			<short>optional, defaults to 2*rate</short>
		</parameter>
		<description><markdown>
			`burst` is the initial and maximum value for the `magazine`; doing IO drains the `magazine`, which fills up again over time with the specified `rate`.
		</markdown></description>
	</action>

	<action name="io.throttle_pool">
		<short>adds the current connection to a throttle pool for outgoing limits</short>
		<parameter name="rate">
			<short>bytes/sec limit</short>
		</parameter>
		<description><markdown>
			all connections in the same pool are limited as whole. Each `io.throttle_pool` action creates its own pool.
		</markdown></description>
		<example>
			<description><markdown>
				Using the same pool in more than one place:
			</markdown></description>
			<config>
				setup {
					module_load "mod_throttle";
				}
				downloadLimit = {
					io.throttle_pool 1mbyte;
				}
				# now use it wherever you need it...
				downloadLimit;
			</config>
		</example>
	</action>

	<action name="io.throttle_ip">
		<short>adds the current connection to an IP-based throttle pool for outgoing limits</short>
		<parameter name="rate">
			<short>bytes/sec limit</short>
		</parameter>
		<description><markdown>
			all connections from the same IP address in the same pool are limited as whole. Each `io.throttle_ip` action creates its own pool.
		</markdown></description>
		<example>
			<description><markdown>
				Using the same pool in more than one place:
			</markdown></description>
			<config>
				setup {
					module_load "mod_throttle";
				}
				downloadLimit = {
					io.throttle_ip 200kbyte;
				}
				# now use it wherever you need it...
				downloadLimit;
			</config>
		</example>
	</action>

</module>
