haproxy/doc
Tim Duesterhus 6edab865f6 BUG/MEDIUM: lua: Fix IPv6 with separate port support for Socket.connect
The `socket.tcp.connect` method of Lua requires at least two parameters:
The host and the port. The `Socket.connect` method of haproxy requires
only one when a host with a combined port is provided. This stems from
the fact that `str2sa_range` is used internally in `hlua_socket_connect`.
This very fact unfortunately causes a diversion in the behaviour of
Lua's socket class and haproxy's for IPv6 addresses:

  sock:connect("::1", "80")

works fine with Lua, but fails with:

  connect: cannot parse destination address '::1'

in haproxy, because `str2sa_range` parses the trailing `:1` as the port.

This patch forcefully adds a `:` to the end of the address iff a port
number greater than `0` is given as the second parameter.

Technically this breaks backwards compatibility, because the docs state:

> The syntax "127.0.0.1:1234" is valid. in this case, the
> parameter *port* is ignored.

But: The connect() call can only succeed if the second parameter is left
out (which causes no breakage) or if the second parameter is an integer
or a numeric string.

It seems unlikely that someone would provide an address with a port number
and would also provide a second parameter containing a number other than
zero. Thus I feel this breakage is warranted to fix the mismatch between
haproxy's socket class and Lua's one.

This commit should be backported to haproxy 1.8 only, because of the
possible breakage of existing Lua scripts.
2018-01-09 15:22:55 +01:00
..
design-thoughts MAJOR: tproxy: remove support for cttproxy 2015-08-20 19:35:14 +02:00
internals MEDIUM: threads/filters: Add init/deinit callback per thread 2017-10-31 13:58:32 +01:00
lua-api BUG/MEDIUM: lua: Fix IPv6 with separate port support for Socket.connect 2018-01-09 15:22:55 +01:00
51Degrees-device-detection.txt DOC: 51d: Updated git URL and instructions for getting Hash Trie data files. 2017-10-06 16:47:25 +02:00
acl.fig [DOC] add diagrams of queuing and future ACL design 2009-02-22 16:46:38 +01:00
architecture.txt DOC: fix "workaround" spelling 2016-01-15 10:27:09 +01:00
close-options.txt [DOC] add a few old and uncommitted docs 2011-09-05 01:04:44 +02:00
coding-style.txt DOC: update coding-style to reference checkpatch.pl 2015-09-21 16:45:45 +02:00
configuration.txt DOC/MINOR: configuration: typo, formatting fixes 2017-12-27 19:03:32 +01:00
cookie-options.txt [DOC] add a few old and uncommitted docs 2011-09-05 01:04:44 +02:00
DeviceAtlas-device-detection.txt DOC: move the device detection modules documentation to their own files 2016-11-08 15:06:21 +01:00
gpl.txt [LICENSE] licensing clarifications 2006-06-15 21:48:13 +02:00
haproxy.1 MINOR: doc: document the -x flag 2017-04-13 19:15:17 +02:00
intro.txt DOC/MINOR: intro: typo, wording, formatting fixes 2017-12-20 07:01:36 +01:00
lgpl.txt [LICENSE] licensing clarifications 2006-06-15 21:48:13 +02:00
linux-syn-cookies.txt DOC: add doc/linux-syn-cookies.txt 2015-08-11 12:17:41 +02:00
lua.txt DOC: LUA: fix some typos and syntax errors 2016-02-16 11:07:45 +01:00
management.txt DOC: cache: update sections and fix some typos 2017-11-26 23:19:35 +01:00
netscaler-client-ip-insertion-protocol.txt MEDIUM: netscaler: add support for standard NetScaler CIP protocol 2017-12-20 07:04:07 +01:00
network-namespaces.txt MAJOR: namespace: add Linux network namespace support 2014-11-21 07:51:57 +01:00
peers-v2.0.txt DOC: add initial peers protovol v2.0 documentation. 2017-11-24 18:28:05 +01:00
peers.txt DOC: fix mangled version in peers protocol documentation 2017-11-24 18:10:24 +01:00
proxy-protocol.txt DOC: mention lighttpd 1.4.46 implements PROXY 2017-04-05 08:42:39 +02:00
queuing.fig [DOC] add diagrams of queuing and future ACL design 2009-02-22 16:46:38 +01:00
SPOE.txt MINOR: spoe: add force-set-var option in spoe-agent configuration 2017-12-20 08:55:18 +01:00
WURFL-device-detection.txt DOC: move the device detection modules documentation to their own files 2016-11-08 15:06:21 +01:00