From 70f7800986812ad0d1a5dd6f280f66fd2bf1dd12 Mon Sep 17 00:00:00 2001
From: Thijs Schreijer
Date: Tue, 1 Sep 2026 10:00:21 +0200
Subject: docs: document socket.unix and socket.serial, fix stale/missing API
references
Pre-release documentation audit against master. Adds the two fully
undocumented modules and closes gaps found by diffing every docs/*.html
page against its corresponding source:
- New docs/unix.html and docs/serial.html (socket.unix stream/dgram and
socket.serial were never documented), linked from index.html,
introduction.html, socket.html and reference.html. serial.html notes
the current lack of a baud/parity/flow-control API and includes an
os.execute+stty workaround example. Both note Windows is unsupported.
- socket.html: document headers.setcanonic, point to unix/serial modules.
- tcp.html: document getfamily, setpeername/setsockname aliases.
- udp.html: document getfamily, getfd/setfd, dirty; document the
ipv6-multicast-hops/ipv6-unicast-hops aliasing as current (known-buggy)
behavior rather than the originally intended semantics.
- http.html: correct redirect text (301/302/303/307/308, was 301/302
only); document MAXHEADERLINE/MAXHEADERSIZE.
- dns.html: document getnameinfo.
- ltn12.html: document source.rewind and BLOCKSIZE.
- installation.html: fix stale "LuaSocket 3.0" sample output to 3.1.0.
- reference.html: index every anchor added above plus new Unix/Serial
blocks.
---
docs/dns.html | 26 ++
docs/http.html | 9 +-
docs/index.html | 2 +
docs/installation.html | 2 +-
docs/introduction.html | 5 +-
docs/ltn12.html | 38 +++
docs/reference.html | 72 +++++
docs/serial.html | 308 +++++++++++++++++++
docs/socket.html | 29 ++
docs/tcp.html | 43 +++
docs/udp.html | 88 +++++-
docs/unix.html | 795 +++++++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 1411 insertions(+), 6 deletions(-)
create mode 100644 docs/serial.html
create mode 100644 docs/unix.html
(limited to 'docs')
diff --git a/docs/dns.html b/docs/dns.html
index 56ce3ba..e8320e8 100644
--- a/docs/dns.html
+++ b/docs/dns.html
@@ -106,6 +106,32 @@ the resolver. In case of error, the function returns nil
followed by an error message.
+
+
+
+socket.dns.getnameinfo([host] [, service])
+
+
+
+Resolves a host and/or a service name through the system resolver and
+returns their canonical name form. At least one of host or
+service must be given.
+
+
+
+Host is an optional string with a host name or IP address.
+Service is an optional string with a service name or port number.
+
+
+
+If host was given, returns a numerically-indexed table with the
+canonical host name found for each address the resolver returns for
+host. If service was also given, the canonical service
+name is returned as an additional value; if only service was
+given, its canonical name is returned by itself. In case of error, the
+function returns nil followed by an error message.
+
+
diff --git a/docs/http.html b/docs/http.html
index c6423ba..316cd2e 100644
--- a/docs/http.html
+++ b/docs/http.html
@@ -114,7 +114,11 @@ the HTTP module:
- PROXY: default proxy used for connections;
- TIMEOUT: sets the timeout for all I/O operations;
-- USERAGENT: default user agent reported to server.
+- USERAGENT: default user agent reported to server;
+- MAXHEADERLINE: maximum length, in bytes, of a single response
+header line. Defaults to 8192;
+- MAXHEADERSIZE: maximum total size, in bytes, of all response
+header lines combined. Defaults to 65536.
@@ -183,7 +187,8 @@ pump step function used to move data.
Defaults to the LTN12 pump.step function.
proxy: The URL of a proxy server to use. Defaults to no proxy;
redirect: Set to false to prevent the
-function from automatically following 301 or 302 server redirect messages;
+function from automatically following 301, 302, 303, 307 or 308 server
+redirect messages;
create: An optional function to be used instead of
socket.tcp when the communications socket is created.
maxredirects: An optional number specifying the maximum number of
diff --git a/docs/index.html b/docs/index.html
index 3341f8d..7a22dd6 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -67,6 +67,8 @@ In addition, you will find that the
(anything you could possible want to do with one) and
LTN12
(filters, sinks, sources and pumps) modules can be very handy.
+On Unix-like platforms, dedicated Unix domain socket
+and serial port modules are also available.
diff --git a/docs/installation.html b/docs/installation.html
index b56f50f..bdc8b1d 100644
--- a/docs/installation.html
+++ b/docs/installation.html
@@ -57,7 +57,7 @@ luarocks install luasocket
print(socket._VERSION)
-
If you see output like LuaSocket 3.0, the installation was successful.
+If you see output like LuaSocket 3.1.0, the installation was successful.
More Information
For more details, visit the LuaSocket GitHub repository.
diff --git a/docs/introduction.html b/docs/introduction.html
index 51443a0..bc0d535 100644
--- a/docs/introduction.html
+++ b/docs/introduction.html
@@ -304,7 +304,10 @@ io.write(assert(udp:receive()))
Although not covered in the introduction, LuaSocket offers
much more than TCP and UDP functionality. As the library
evolved, support for HTTP, FTP,
-and SMTP were built on top of these. These modules
+and SMTP were built on top of these. On Unix-like
+platforms, the library also ships separate Unix domain
+socket and serial port modules, requirable as
+socket.unix and socket.serial. These modules
and many others are covered by the reference manual.
diff --git a/docs/ltn12.html b/docs/ltn12.html
index 30bc564..76b3984 100644
--- a/docs/ltn12.html
+++ b/docs/ltn12.html
@@ -55,6 +55,20 @@ To obtain the ltn12 namespace, run:
local ltn12 = require("ltn12")
+
+
+
+ltn12.BLOCKSIZE
+
+
+
+The default chunk size, in bytes, used internally by the built-in sources
+and sinks (e.g. source.string,
+source.file) when they have no more
+natural chunk size of their own. Defaults to 2048. Changing it affects
+only sources/sinks created after the change.
+
+
Filters
@@ -415,6 +429,30 @@ ltn12.source.table(table)
Creates and returns a source that produces the numerically-indexed values of a table successively beginning at 1. The source returns nil (end-of-stream) whenever a nil value is produced by the current index, which proceeds forward regardless.
+
+
+
+ltn12.source.rewind(source)
+
+
+
+Wraps a fancy source to add chunk pushback, so previously
+produced chunks can be fed back in for a later read to consume again.
+
+
+
+Source is the fancy source being wrapped.
+
+
+
+The function returns a new fancy source. Calling it with no arguments reads
+the next chunk as usual: any chunks previously pushed back are returned
+first (most recently pushed back, first), and once none remain it falls
+through to source. Calling it with a chunk argument does
+not read anything: it pushes that chunk back onto the internal stack for a
+future no-argument call to return.
+
+