diff options
| author | Caleb Maclennan <caleb@alerque.com> | 2023-11-11 08:07:36 +0300 |
|---|---|---|
| committer | Caleb Maclennan <caleb@alerque.com> | 2023-11-11 08:07:38 +0300 |
| commit | 453a5207eda52939181233bffffa67171ef838bd (patch) | |
| tree | cfdc3b5a890f2a201024688357474997a3e77c0a /docs | |
| parent | de359ea4083ac6d944216229e4104dc36537c29c (diff) | |
| download | luasocket-453a5207eda52939181233bffffa67171ef838bd.tar.gz luasocket-453a5207eda52939181233bffffa67171ef838bd.tar.bz2 luasocket-453a5207eda52939181233bffffa67171ef838bd.zip | |
style(docs): Trim trailing whitespace in HTML docs
Many editors remove these automatically anyway which makes opening and
editng the docs cause a bunch of noise. This is just to get the noise
out of the way in a style commit so it doesn't leak into other PRs
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/installation.html | 16 | ||||
| -rw-r--r-- | docs/introduction.html | 110 | ||||
| -rw-r--r-- | docs/url.html | 38 |
3 files changed, 82 insertions, 82 deletions
diff --git a/docs/installation.html b/docs/installation.html index 24bc1bd..25c0bba 100644 --- a/docs/installation.html +++ b/docs/installation.html | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> | 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> | 3 | <html> |
| 4 | 4 | ||
| 5 | <head> | 5 | <head> |
| 6 | <meta name="description" content="LuaSocket: Introduction to the core"> | 6 | <meta name="description" content="LuaSocket: Introduction to the core"> |
| 7 | <meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network, Support, | 7 | <meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network, Support, |
| 8 | Installation"> | 8 | Installation"> |
| 9 | <title>LuaSocket: Installation</title> | 9 | <title>LuaSocket: Installation</title> |
| 10 | <link rel="stylesheet" href="reference.css" type="text/css"> | 10 | <link rel="stylesheet" href="reference.css" type="text/css"> |
| 11 | </head> | 11 | </head> |
| @@ -29,7 +29,7 @@ Installation"> | |||
| 29 | <a href="index.html#download">download</a> · | 29 | <a href="index.html#download">download</a> · |
| 30 | <a href="installation.html">installation</a> · | 30 | <a href="installation.html">installation</a> · |
| 31 | <a href="introduction.html">introduction</a> · | 31 | <a href="introduction.html">introduction</a> · |
| 32 | <a href="reference.html">reference</a> | 32 | <a href="reference.html">reference</a> |
| 33 | </p> | 33 | </p> |
| 34 | </center> | 34 | </center> |
| 35 | <hr> | 35 | <hr> |
| @@ -48,8 +48,8 @@ will likely already have been answered. </p> | |||
| 48 | 48 | ||
| 49 | <p> On Unix systems, the standard distribution uses two base | 49 | <p> On Unix systems, the standard distribution uses two base |
| 50 | directories, one for system dependent files, and another for system | 50 | directories, one for system dependent files, and another for system |
| 51 | independent files. Let's call these directories <tt><CDIR></tt> | 51 | independent files. Let's call these directories <tt><CDIR></tt> |
| 52 | and <tt><LDIR></tt>, respectively. | 52 | and <tt><LDIR></tt>, respectively. |
| 53 | For example, in my laptp, Lua 5.1 is configured to | 53 | For example, in my laptp, Lua 5.1 is configured to |
| 54 | use '<tt>/usr/local/lib/lua/5.1</tt>' for | 54 | use '<tt>/usr/local/lib/lua/5.1</tt>' for |
| 55 | <tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.1</tt>' for | 55 | <tt><CDIR></tt> and '<tt>/usr/local/share/lua/5.1</tt>' for |
| @@ -57,9 +57,9 @@ use '<tt>/usr/local/lib/lua/5.1</tt>' for | |||
| 57 | usually points to the directory where the Lua executable is | 57 | usually points to the directory where the Lua executable is |
| 58 | found, and <tt><LDIR></tt> points to a | 58 | found, and <tt><LDIR></tt> points to a |
| 59 | <tt>lua/</tt> directory inside <tt><CDIR></tt>. (These | 59 | <tt>lua/</tt> directory inside <tt><CDIR></tt>. (These |
| 60 | settings can be overridden by environment variables | 60 | settings can be overridden by environment variables |
| 61 | <tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua | 61 | <tt>LUA_PATH</tt> and <tt>LUA_CPATH</tt>. See the Lua |
| 62 | documentation for details.) Here is the standard LuaSocket | 62 | documentation for details.) Here is the standard LuaSocket |
| 63 | distribution directory structure:</p> | 63 | distribution directory structure:</p> |
| 64 | 64 | ||
| 65 | <pre class=example> | 65 | <pre class=example> |
| @@ -76,7 +76,7 @@ distribution directory structure:</p> | |||
| 76 | </pre> | 76 | </pre> |
| 77 | 77 | ||
| 78 | <p> Naturally, on Unix systems, <tt>core.dll</tt> | 78 | <p> Naturally, on Unix systems, <tt>core.dll</tt> |
| 79 | would be replaced by <tt>core.so</tt>. | 79 | would be replaced by <tt>core.so</tt>. |
| 80 | </p> | 80 | </p> |
| 81 | 81 | ||
| 82 | <h3>Using LuaSocket</h3> | 82 | <h3>Using LuaSocket</h3> |
diff --git a/docs/introduction.html b/docs/introduction.html index fd22f48..51443a0 100644 --- a/docs/introduction.html +++ b/docs/introduction.html | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> | 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> | 3 | <html> |
| 4 | 4 | ||
| 5 | <head> | 5 | <head> |
| 6 | <meta name="description" content="LuaSocket: Introduction to the core"> | 6 | <meta name="description" content="LuaSocket: Introduction to the core"> |
| 7 | <meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network, | 7 | <meta name="keywords" content="Lua, LuaSocket, TCP, UDP, Network, |
| 8 | Library, Support"> | 8 | Library, Support"> |
| 9 | <title>LuaSocket: Introduction to the core</title> | 9 | <title>LuaSocket: Introduction to the core</title> |
| 10 | <link rel="stylesheet" href="reference.css" type="text/css"> | 10 | <link rel="stylesheet" href="reference.css" type="text/css"> |
| 11 | </head> | 11 | </head> |
| @@ -29,7 +29,7 @@ Library, Support"> | |||
| 29 | <a href="index.html#download">download</a> · | 29 | <a href="index.html#download">download</a> · |
| 30 | <a href="installation.html">installation</a> · | 30 | <a href="installation.html">installation</a> · |
| 31 | <a href="introduction.html">introduction</a> · | 31 | <a href="introduction.html">introduction</a> · |
| 32 | <a href="reference.html">reference</a> | 32 | <a href="reference.html">reference</a> |
| 33 | </p> | 33 | </p> |
| 34 | </center> | 34 | </center> |
| 35 | <hr> | 35 | <hr> |
| @@ -61,23 +61,23 @@ interface to I/O across different domains and operating systems. | |||
| 61 | The API design had two goals in mind. First, users | 61 | The API design had two goals in mind. First, users |
| 62 | experienced with the C API to sockets should feel comfortable using LuaSocket. | 62 | experienced with the C API to sockets should feel comfortable using LuaSocket. |
| 63 | Second, the simplicity and the feel of the Lua language should be | 63 | Second, the simplicity and the feel of the Lua language should be |
| 64 | preserved. To achieve these goals, the LuaSocket API keeps the function names and semantics the C API whenever possible, but their usage in Lua has been greatly simplified. | 64 | preserved. To achieve these goals, the LuaSocket API keeps the function names and semantics the C API whenever possible, but their usage in Lua has been greatly simplified. |
| 65 | </p> | 65 | </p> |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | <p> | 68 | <p> |
| 69 | One of the simplifications is the receive pattern capability. | 69 | One of the simplifications is the receive pattern capability. |
| 70 | Applications can read data from stream domains (such as TCP) | 70 | Applications can read data from stream domains (such as TCP) |
| 71 | line by line, block by block, or until the connection is closed. | 71 | line by line, block by block, or until the connection is closed. |
| 72 | All I/O reads are buffered and the performance differences between | 72 | All I/O reads are buffered and the performance differences between |
| 73 | different receive patterns are negligible. | 73 | different receive patterns are negligible. |
| 74 | </p> | 74 | </p> |
| 75 | 75 | ||
| 76 | <p> | 76 | <p> |
| 77 | Another advantage is the flexible timeout control | 77 | Another advantage is the flexible timeout control |
| 78 | mechanism. As in C, all I/O operations are blocking by default. For | 78 | mechanism. As in C, all I/O operations are blocking by default. For |
| 79 | example, the <a href=tcp.html#send><tt>send</tt></a>, | 79 | example, the <a href=tcp.html#send><tt>send</tt></a>, |
| 80 | <a href=tcp.html#receive><tt>receive</tt></a> and | 80 | <a href=tcp.html#receive><tt>receive</tt></a> and |
| 81 | <a href=tcp.html#accept><tt>accept</tt></a> methods | 81 | <a href=tcp.html#accept><tt>accept</tt></a> methods |
| 82 | of the TCP domain will block the caller application until | 82 | of the TCP domain will block the caller application until |
| 83 | the operation is completed (if ever!). However, with a call to the | 83 | the operation is completed (if ever!). However, with a call to the |
| @@ -87,7 +87,7 @@ the time it can be blocked by LuaSocket (the "<tt>total</tt>" timeout), on | |||
| 87 | the time LuaSocket can internally be blocked by any OS call (the | 87 | the time LuaSocket can internally be blocked by any OS call (the |
| 88 | "<tt>block</tt>" timeout) or a combination of the two. Each LuaSocket | 88 | "<tt>block</tt>" timeout) or a combination of the two. Each LuaSocket |
| 89 | call might perform several OS calls, so that the two timeout values are | 89 | call might perform several OS calls, so that the two timeout values are |
| 90 | <em>not</em> equivalent. | 90 | <em>not</em> equivalent. |
| 91 | </p> | 91 | </p> |
| 92 | 92 | ||
| 93 | <p> | 93 | <p> |
| @@ -95,10 +95,10 @@ Finally, the host name resolution is transparent, meaning that most | |||
| 95 | functions and methods accept both IP addresses and host names. In case a | 95 | functions and methods accept both IP addresses and host names. In case a |
| 96 | host name is given, the library queries the system's resolver and | 96 | host name is given, the library queries the system's resolver and |
| 97 | tries the main IP address returned. Note that direct use of IP addresses | 97 | tries the main IP address returned. Note that direct use of IP addresses |
| 98 | is more efficient, of course. The | 98 | is more efficient, of course. The |
| 99 | <a href=dns.html#toip><tt>toip</tt></a> | 99 | <a href=dns.html#toip><tt>toip</tt></a> |
| 100 | and <a href=dns.html#tohostname><tt>tohostname</tt></a> | 100 | and <a href=dns.html#tohostname><tt>tohostname</tt></a> |
| 101 | functions from the DNS module are provided to convert between host names and IP addresses. | 101 | functions from the DNS module are provided to convert between host names and IP addresses. |
| 102 | </p> | 102 | </p> |
| 103 | 103 | ||
| 104 | <p> | 104 | <p> |
| @@ -118,47 +118,47 @@ reassembled transparently on the other end. There are no boundaries in | |||
| 118 | the data transfers. The library allows users to read data from the | 118 | the data transfers. The library allows users to read data from the |
| 119 | sockets in several different granularities: patterns are available for | 119 | sockets in several different granularities: patterns are available for |
| 120 | lines, arbitrary sized blocks or "read up to connection closed", all with | 120 | lines, arbitrary sized blocks or "read up to connection closed", all with |
| 121 | good performance. | 121 | good performance. |
| 122 | </p> | 122 | </p> |
| 123 | 123 | ||
| 124 | <p> | 124 | <p> |
| 125 | The library distinguishes three types of TCP sockets: <em>master</em>, | 125 | The library distinguishes three types of TCP sockets: <em>master</em>, |
| 126 | <em>client</em> and <em>server</em> sockets. | 126 | <em>client</em> and <em>server</em> sockets. |
| 127 | </p> | 127 | </p> |
| 128 | 128 | ||
| 129 | <p> | 129 | <p> |
| 130 | Master sockets are newly created TCP sockets returned by the function | 130 | Master sockets are newly created TCP sockets returned by the function |
| 131 | <a href=tcp.html#tcp><tt>socket.tcp</tt></a>. A master socket is | 131 | <a href=tcp.html#tcp><tt>socket.tcp</tt></a>. A master socket is |
| 132 | transformed into a server socket | 132 | transformed into a server socket |
| 133 | after it is associated with a <em>local</em> address by a call to the | 133 | after it is associated with a <em>local</em> address by a call to the |
| 134 | <a href=tcp.html#bind><tt>bind</tt></a> method followed by a call to the | 134 | <a href=tcp.html#bind><tt>bind</tt></a> method followed by a call to the |
| 135 | <a href=tcp.html#listen><tt>listen</tt></a>. Conversely, a master socket | 135 | <a href=tcp.html#listen><tt>listen</tt></a>. Conversely, a master socket |
| 136 | can be changed into a client socket with the method | 136 | can be changed into a client socket with the method |
| 137 | <a href=tcp.html#connect><tt>connect</tt></a>, | 137 | <a href=tcp.html#connect><tt>connect</tt></a>, |
| 138 | which associates it with a <em>remote</em> address. | 138 | which associates it with a <em>remote</em> address. |
| 139 | </p> | 139 | </p> |
| 140 | 140 | ||
| 141 | <p> | 141 | <p> |
| 142 | On server sockets, applications can use the | 142 | On server sockets, applications can use the |
| 143 | <a href=tcp.html#accept><tt>accept</tt></a> method | 143 | <a href=tcp.html#accept><tt>accept</tt></a> method |
| 144 | to wait for a client connection. Once a connection is established, a | 144 | to wait for a client connection. Once a connection is established, a |
| 145 | client socket object is returned representing this connection. The | 145 | client socket object is returned representing this connection. The |
| 146 | other methods available for server socket objects are | 146 | other methods available for server socket objects are |
| 147 | <a href=tcp.html#getsockname><tt>getsockname</tt></a>, | 147 | <a href=tcp.html#getsockname><tt>getsockname</tt></a>, |
| 148 | <a href=tcp.html#setoption><tt>setoption</tt></a>, | 148 | <a href=tcp.html#setoption><tt>setoption</tt></a>, |
| 149 | <a href=tcp.html#settimeout><tt>settimeout</tt></a>, and | 149 | <a href=tcp.html#settimeout><tt>settimeout</tt></a>, and |
| 150 | <a href=tcp.html#close><tt>close</tt></a>. | 150 | <a href=tcp.html#close><tt>close</tt></a>. |
| 151 | </p> | 151 | </p> |
| 152 | 152 | ||
| 153 | <p> | 153 | <p> |
| 154 | Client sockets are used to exchange data between two applications over | 154 | Client sockets are used to exchange data between two applications over |
| 155 | the Internet. Applications can call the methods | 155 | the Internet. Applications can call the methods |
| 156 | <a href=tcp.html#send><tt>send</tt></a> and | 156 | <a href=tcp.html#send><tt>send</tt></a> and |
| 157 | <a href=tcp.html#receive><tt>receive</tt></a> | 157 | <a href=tcp.html#receive><tt>receive</tt></a> |
| 158 | to send and receive data. The other methods | 158 | to send and receive data. The other methods |
| 159 | available for client socket objects are | 159 | available for client socket objects are |
| 160 | <a href=tcp.html#getsockname><tt>getsockname</tt></a>, | 160 | <a href=tcp.html#getsockname><tt>getsockname</tt></a>, |
| 161 | <a href=tcp.html#getpeername><tt>getpeername</tt></a>, | 161 | <a href=tcp.html#getpeername><tt>getpeername</tt></a>, |
| 162 | <a href=tcp.html#setoption><tt>setoption</tt></a>, | 162 | <a href=tcp.html#setoption><tt>setoption</tt></a>, |
| 163 | <a href=tcp.html#settimeout><tt>settimeout</tt></a>, | 163 | <a href=tcp.html#settimeout><tt>settimeout</tt></a>, |
| 164 | <a href=tcp.html#shutdown><tt>shutdown</tt></a>, and | 164 | <a href=tcp.html#shutdown><tt>shutdown</tt></a>, and |
| @@ -175,7 +175,7 @@ port (one that is chosen by the operating system) on the local host and | |||
| 175 | awaits client connections on that port. When a connection is established, | 175 | awaits client connections on that port. When a connection is established, |
| 176 | the program reads a line from the remote end and sends it back, closing | 176 | the program reads a line from the remote end and sends it back, closing |
| 177 | the connection immediately. You can test it using the telnet | 177 | the connection immediately. You can test it using the telnet |
| 178 | program. | 178 | program. |
| 179 | </p> | 179 | </p> |
| 180 | 180 | ||
| 181 | <pre class=example> | 181 | <pre class=example> |
| @@ -217,68 +217,68 @@ error free. Data transfers are atomic, one datagram at a time. Reading | |||
| 217 | only part of a datagram discards the rest, so that the following read | 217 | only part of a datagram discards the rest, so that the following read |
| 218 | operation will act on the next datagram. The advantages are in | 218 | operation will act on the next datagram. The advantages are in |
| 219 | simplicity (no connection setup) and performance (no error checking or | 219 | simplicity (no connection setup) and performance (no error checking or |
| 220 | error correction). | 220 | error correction). |
| 221 | </p> | 221 | </p> |
| 222 | 222 | ||
| 223 | <p> | 223 | <p> |
| 224 | Note that although no guarantees are made, these days | 224 | Note that although no guarantees are made, these days |
| 225 | networks are so good that, under normal circumstances, few errors | 225 | networks are so good that, under normal circumstances, few errors |
| 226 | happen in practice. | 226 | happen in practice. |
| 227 | </p> | 227 | </p> |
| 228 | 228 | ||
| 229 | <p> | 229 | <p> |
| 230 | An UDP socket object is created by the | 230 | An UDP socket object is created by the |
| 231 | <a href=udp.html#udp><tt>socket.udp</tt></a> function. UDP | 231 | <a href=udp.html#udp><tt>socket.udp</tt></a> function. UDP |
| 232 | sockets do not need to be connected before use. The method | 232 | sockets do not need to be connected before use. The method |
| 233 | <a href=udp.html#sendto><tt>sendto</tt></a> | 233 | <a href=udp.html#sendto><tt>sendto</tt></a> |
| 234 | can be used immediately after creation to | 234 | can be used immediately after creation to |
| 235 | send a datagram to IP address and port. Host names are not allowed | 235 | send a datagram to IP address and port. Host names are not allowed |
| 236 | because performing name resolution for each packet would be forbiddingly | 236 | because performing name resolution for each packet would be forbiddingly |
| 237 | slow. Methods | 237 | slow. Methods |
| 238 | <a href=udp.html#receive><tt>receive</tt></a> and | 238 | <a href=udp.html#receive><tt>receive</tt></a> and |
| 239 | <a href=udp.html#receivefrom><tt>receivefrom</tt></a> | 239 | <a href=udp.html#receivefrom><tt>receivefrom</tt></a> |
| 240 | can be used to retrieve datagrams, the latter returning the IP and port of | 240 | can be used to retrieve datagrams, the latter returning the IP and port of |
| 241 | the sender as extra return values (thus being slightly less | 241 | the sender as extra return values (thus being slightly less |
| 242 | efficient). | 242 | efficient). |
| 243 | </p> | 243 | </p> |
| 244 | 244 | ||
| 245 | <p> | 245 | <p> |
| 246 | When communication is performed repeatedly with a single peer, an | 246 | When communication is performed repeatedly with a single peer, an |
| 247 | application should call the | 247 | application should call the |
| 248 | <a href=udp.html#setpeername><tt>setpeername</tt></a> method to specify a | 248 | <a href=udp.html#setpeername><tt>setpeername</tt></a> method to specify a |
| 249 | permanent partner. Methods | 249 | permanent partner. Methods |
| 250 | <a href=udp.html#sendto><tt>sendto</tt></a> and | 250 | <a href=udp.html#sendto><tt>sendto</tt></a> and |
| 251 | <a href=udp.html#receivefrom><tt>receivefrom</tt></a> | 251 | <a href=udp.html#receivefrom><tt>receivefrom</tt></a> |
| 252 | can no longer be used, but the method | 252 | can no longer be used, but the method |
| 253 | <a href=udp.html#send><tt>send</tt></a> can be used to send data | 253 | <a href=udp.html#send><tt>send</tt></a> can be used to send data |
| 254 | directly to the peer, and the method | 254 | directly to the peer, and the method |
| 255 | <a href=udp.html#receive><tt>receive</tt></a> | 255 | <a href=udp.html#receive><tt>receive</tt></a> |
| 256 | will only return datagrams originating | 256 | will only return datagrams originating |
| 257 | from that peer. There is about 30% performance gain due to this practice. | 257 | from that peer. There is about 30% performance gain due to this practice. |
| 258 | </p> | 258 | </p> |
| 259 | 259 | ||
| 260 | <p> | 260 | <p> |
| 261 | To associate an UDP socket with a local address, an application calls the | 261 | To associate an UDP socket with a local address, an application calls the |
| 262 | <a href=udp.html#setsockname><tt>setsockname</tt></a> | 262 | <a href=udp.html#setsockname><tt>setsockname</tt></a> |
| 263 | method <em>before</em> sending any datagrams. Otherwise, the socket is | 263 | method <em>before</em> sending any datagrams. Otherwise, the socket is |
| 264 | automatically bound to an ephemeral address before the first data | 264 | automatically bound to an ephemeral address before the first data |
| 265 | transmission and once bound the local address cannot be changed. | 265 | transmission and once bound the local address cannot be changed. |
| 266 | The other methods available for UDP sockets are | 266 | The other methods available for UDP sockets are |
| 267 | <a href=udp.html#getpeername><tt>getpeername</tt></a>, | 267 | <a href=udp.html#getpeername><tt>getpeername</tt></a>, |
| 268 | <a href=udp.html#getsockname><tt>getsockname</tt></a>, | 268 | <a href=udp.html#getsockname><tt>getsockname</tt></a>, |
| 269 | <a href=udp.html#settimeout><tt>settimeout</tt></a>, | 269 | <a href=udp.html#settimeout><tt>settimeout</tt></a>, |
| 270 | <a href=udp.html#setoption><tt>setoption</tt></a> and | 270 | <a href=udp.html#setoption><tt>setoption</tt></a> and |
| 271 | <a href=udp.html#close><tt>close</tt></a>. | 271 | <a href=udp.html#close><tt>close</tt></a>. |
| 272 | </p> | 272 | </p> |
| 273 | 273 | ||
| 274 | <p> | 274 | <p> |
| 275 | Example: | 275 | Example: |
| 276 | </p> | 276 | </p> |
| 277 | <blockquote> | 277 | <blockquote> |
| 278 | <p> | 278 | <p> |
| 279 | A simple daytime client, using LuaSocket. The program connects to a remote | 279 | A simple daytime client, using LuaSocket. The program connects to a remote |
| 280 | server and tries to retrieve the daytime, printing the answer it got or an | 280 | server and tries to retrieve the daytime, printing the answer it got or an |
| 281 | error message. | 281 | error message. |
| 282 | </p> | 282 | </p> |
| 283 | 283 | ||
| 284 | <pre class=example> | 284 | <pre class=example> |
| @@ -301,11 +301,11 @@ io.write(assert(udp:receive())) | |||
| 301 | 301 | ||
| 302 | <h3 id=more>Support modules</h3> | 302 | <h3 id=more>Support modules</h3> |
| 303 | 303 | ||
| 304 | <p> Although not covered in the introduction, LuaSocket offers | 304 | <p> Although not covered in the introduction, LuaSocket offers |
| 305 | much more than TCP and UDP functionality. As the library | 305 | much more than TCP and UDP functionality. As the library |
| 306 | evolved, support for <a href=http.html>HTTP</a>, <a href=ftp.html>FTP</a>, | 306 | evolved, support for <a href=http.html>HTTP</a>, <a href=ftp.html>FTP</a>, |
| 307 | and <a href=smtp.html>SMTP</a> were built on top of these. These modules | 307 | and <a href=smtp.html>SMTP</a> were built on top of these. These modules |
| 308 | and many others are covered by the <a href=reference.html>reference manual</a>. | 308 | and many others are covered by the <a href=reference.html>reference manual</a>. |
| 309 | </p> | 309 | </p> |
| 310 | 310 | ||
| 311 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 311 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
diff --git a/docs/url.html b/docs/url.html index 6ff673d..e03b094 100644 --- a/docs/url.html +++ b/docs/url.html | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> | 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> | 3 | <html> |
| 4 | 4 | ||
| 5 | <head> | 5 | <head> |
| 6 | <meta name="description" content="LuaSocket: URL manipulation"> | 6 | <meta name="description" content="LuaSocket: URL manipulation"> |
| 7 | <meta name="keywords" content="Lua, LuaSocket, URL, Library, Link, Network, Support"> | 7 | <meta name="keywords" content="Lua, LuaSocket, URL, Library, Link, Network, Support"> |
| 8 | <title>LuaSocket: URL support</title> | 8 | <title>LuaSocket: URL support</title> |
| 9 | <link rel="stylesheet" href="reference.css" type="text/css"> | 9 | <link rel="stylesheet" href="reference.css" type="text/css"> |
| 10 | </head> | 10 | </head> |
| @@ -28,7 +28,7 @@ | |||
| 28 | <a href="index.html#download">download</a> · | 28 | <a href="index.html#download">download</a> · |
| 29 | <a href="installation.html">installation</a> · | 29 | <a href="installation.html">installation</a> · |
| 30 | <a href="introduction.html">introduction</a> · | 30 | <a href="introduction.html">introduction</a> · |
| 31 | <a href="reference.html">reference</a> | 31 | <a href="reference.html">reference</a> |
| 32 | </p> | 32 | </p> |
| 33 | </center> | 33 | </center> |
| 34 | <hr> | 34 | <hr> |
| @@ -36,21 +36,21 @@ | |||
| 36 | 36 | ||
| 37 | <!-- url ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 37 | <!-- url ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 38 | 38 | ||
| 39 | <h2 id="url">URL</h2> | 39 | <h2 id="url">URL</h2> |
| 40 | 40 | ||
| 41 | <p> | 41 | <p> |
| 42 | The <tt>url</tt> namespace provides functions to parse, protect, | 42 | The <tt>url</tt> namespace provides functions to parse, protect, |
| 43 | and build URLs, as well as functions to compose absolute URLs | 43 | and build URLs, as well as functions to compose absolute URLs |
| 44 | from base and relative URLs, according to | 44 | from base and relative URLs, according to |
| 45 | <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>. | 45 | <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>. |
| 46 | </p> | 46 | </p> |
| 47 | 47 | ||
| 48 | <p> | 48 | <p> |
| 49 | To obtain the <tt>url</tt> namespace, run: | 49 | To obtain the <tt>url</tt> namespace, run: |
| 50 | </p> | 50 | </p> |
| 51 | 51 | ||
| 52 | <pre class=example> | 52 | <pre class=example> |
| 53 | -- loads the URL module | 53 | -- loads the URL module |
| 54 | local url = require("socket.url") | 54 | local url = require("socket.url") |
| 55 | </pre> | 55 | </pre> |
| 56 | 56 | ||
| @@ -74,7 +74,7 @@ url.<b>absolute(</b>base, relative<b>)</b> | |||
| 74 | </p> | 74 | </p> |
| 75 | 75 | ||
| 76 | <p class=description> | 76 | <p class=description> |
| 77 | Builds an absolute URL from a base URL and a relative URL. | 77 | Builds an absolute URL from a base URL and a relative URL. |
| 78 | </p> | 78 | </p> |
| 79 | 79 | ||
| 80 | <p class=parameters> | 80 | <p class=parameters> |
| @@ -130,14 +130,14 @@ url.<b>build(</b>parsed_url<b>)</b> | |||
| 130 | </p> | 130 | </p> |
| 131 | 131 | ||
| 132 | <p class=description> | 132 | <p class=description> |
| 133 | Rebuilds an URL from its parts. | 133 | Rebuilds an URL from its parts. |
| 134 | </p> | 134 | </p> |
| 135 | 135 | ||
| 136 | <p class=parameters> | 136 | <p class=parameters> |
| 137 | <tt>Parsed_url</tt> is a table with same components returned by | 137 | <tt>Parsed_url</tt> is a table with same components returned by |
| 138 | <a href="#parse"><tt>parse</tt></a>. | 138 | <a href="#parse"><tt>parse</tt></a>. |
| 139 | Lower level components, if specified, | 139 | Lower level components, if specified, |
| 140 | take precedence over high level components of the URL grammar. | 140 | take precedence over high level components of the URL grammar. |
| 141 | </p> | 141 | </p> |
| 142 | 142 | ||
| 143 | <p class=return> | 143 | <p class=return> |
| @@ -152,10 +152,10 @@ url.<b>build_path(</b>segments, unsafe<b>)</b> | |||
| 152 | 152 | ||
| 153 | <p class=description> | 153 | <p class=description> |
| 154 | Builds a <tt><path></tt> component from a list of | 154 | Builds a <tt><path></tt> component from a list of |
| 155 | <tt><segment></tt> parts. | 155 | <tt><segment></tt> parts. |
| 156 | Before composition, any reserved characters found in a segment are escaped into | 156 | Before composition, any reserved characters found in a segment are escaped into |
| 157 | their protected form, so that the resulting path is a valid URL path | 157 | their protected form, so that the resulting path is a valid URL path |
| 158 | component. | 158 | component. |
| 159 | </p> | 159 | </p> |
| 160 | 160 | ||
| 161 | <p class=parameters> | 161 | <p class=parameters> |
| @@ -165,8 +165,8 @@ characters are left untouched. | |||
| 165 | </p> | 165 | </p> |
| 166 | 166 | ||
| 167 | <p class=return> | 167 | <p class=return> |
| 168 | The function returns a string with the | 168 | The function returns a string with the |
| 169 | built <tt><path></tt> component. | 169 | built <tt><path></tt> component. |
| 170 | </p> | 170 | </p> |
| 171 | 171 | ||
| 172 | <!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 172 | <!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| @@ -178,7 +178,7 @@ url.<b>escape(</b>content<b>)</b> | |||
| 178 | <p class=description> | 178 | <p class=description> |
| 179 | Applies the URL escaping content coding to a string | 179 | Applies the URL escaping content coding to a string |
| 180 | Each byte is encoded as a percent character followed | 180 | Each byte is encoded as a percent character followed |
| 181 | by the two byte hexadecimal representation of its integer | 181 | by the two byte hexadecimal representation of its integer |
| 182 | value. | 182 | value. |
| 183 | </p> | 183 | </p> |
| 184 | 184 | ||
| @@ -270,8 +270,8 @@ url.<b>parse_path(</b>path<b>)</b> | |||
| 270 | </p> | 270 | </p> |
| 271 | 271 | ||
| 272 | <p class=description> | 272 | <p class=description> |
| 273 | Breaks a <tt><path></tt> URL component into all its | 273 | Breaks a <tt><path></tt> URL component into all its |
| 274 | <tt><segment></tt> parts. | 274 | <tt><segment></tt> parts. |
| 275 | </p> | 275 | </p> |
| 276 | 276 | ||
| 277 | <p class=description> | 277 | <p class=description> |
| @@ -282,7 +282,7 @@ Breaks a <tt><path></tt> URL component into all its | |||
| 282 | Since some characters are reserved in URLs, they must be escaped | 282 | Since some characters are reserved in URLs, they must be escaped |
| 283 | whenever present in a <tt><path></tt> component. Therefore, before | 283 | whenever present in a <tt><path></tt> component. Therefore, before |
| 284 | returning a list with all the parsed segments, the function removes | 284 | returning a list with all the parsed segments, the function removes |
| 285 | escaping from all of them. | 285 | escaping from all of them. |
| 286 | </p> | 286 | </p> |
| 287 | 287 | ||
| 288 | <!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 288 | <!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| @@ -300,7 +300,7 @@ Removes the URL escaping content coding from a string. | |||
| 300 | </p> | 300 | </p> |
| 301 | 301 | ||
| 302 | <p class=return> | 302 | <p class=return> |
| 303 | The function returns the decoded string. | 303 | The function returns the decoded string. |
| 304 | </p> | 304 | </p> |
| 305 | 305 | ||
| 306 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 306 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
