aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-21 06:07:58 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-21 06:07:58 +0000
commitbce1cb30d856d167e167c4c2997f9bebe03a612c (patch)
tree8e684b912cdc9d27c5aebf593107487c94866438
parentf7579db9e830ef41f422a280d26c9077f48728e5 (diff)
downloadluasocket-bce1cb30d856d167e167c4c2997f9bebe03a612c.tar.gz
luasocket-bce1cb30d856d167e167c4c2997f9bebe03a612c.tar.bz2
luasocket-bce1cb30d856d167e167c4c2997f9bebe03a612c.zip
More adjustments/bugfixes.
-rw-r--r--doc/dns.html6
-rw-r--r--doc/ftp.html10
-rw-r--r--doc/http.html6
-rw-r--r--doc/index.html6
-rw-r--r--doc/introduction.html8
-rw-r--r--doc/ltn12.html7
-rw-r--r--doc/mime.html8
-rw-r--r--doc/reference.html6
-rw-r--r--doc/smtp.html12
-rw-r--r--doc/socket.html20
-rw-r--r--doc/tcp.html17
-rw-r--r--doc/udp.html12
-rw-r--r--doc/url.html12
-rw-r--r--samples/cddb.lua4
-rw-r--r--samples/daytimeclnt.lua2
-rw-r--r--samples/echosrvr.lua2
-rw-r--r--samples/talker.lua2
-rw-r--r--samples/tinyirc.lua2
-rw-r--r--src/http.lua2
-rw-r--r--src/luasocket.h3
-rw-r--r--src/mime.h3
-rw-r--r--src/mime.lua32
-rw-r--r--src/socket.lua3
-rw-r--r--src/tcp.c6
-rw-r--r--src/udp.c6
-rw-r--r--src/usocket.c6
-rw-r--r--src/wsocket.c6
-rw-r--r--test/httptest.lua10
-rw-r--r--test/mimetest.lua2
-rw-r--r--test/stufftest.lua2
-rw-r--r--test/testclnt.lua4
-rw-r--r--test/testsrvr.lua2
-rw-r--r--test/urltest.lua2
33 files changed, 135 insertions, 96 deletions
diff --git a/doc/dns.html b/doc/dns.html
index 47134d8..09a9bdb 100644
--- a/doc/dns.html
+++ b/doc/dns.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: DNS support">
7<meta name="keywords" content="Lua, Library, DNS, Network, Support">
8<title>LuaSocket: DNS support</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
diff --git a/doc/ftp.html b/doc/ftp.html
index fe514e9..158b402 100644
--- a/doc/ftp.html
+++ b/doc/ftp.html
@@ -1,7 +1,11 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3<html>
2 4
3<head> 5<head>
4<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: FTP support">
7<meta name="keywords" content="Lua, Library, FTP, Network, Support">
8<title>LuaSocket: FTP support</title>
5<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
6</head> 10</head>
7 11
@@ -14,7 +18,7 @@
14<center> 18<center>
15<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
16<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
17<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
18</a></td></tr> 22</a></td></tr>
19<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
20</td></tr> 24</td></tr>
diff --git a/doc/http.html b/doc/http.html
index 4780436..13acd1c 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: HTTP support">
7<meta name="keywords" content="Lua, Library, HTTP, WWW, browser, Network, Support">
8<title>LuaSocket: HTTP support</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
diff --git a/doc/index.html b/doc/index.html
index 0e9eb1d..abba703 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -3,6 +3,8 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<meta name="description" content="The LuaSocket Homepage">
7<meta name="keywords" content="Lua, Library, Network, Support, Internet">
6<title>LuaSocket: Network support for the Lua language </title> 8<title>LuaSocket: Network support for the Lua language </title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -276,7 +278,7 @@ return convention WILL break old code;
276 does not call <tt>listen</tt> anymore. It is the new <tt>listen</tt> 278 does not call <tt>listen</tt> anymore. It is the new <tt>listen</tt>
277method that turns a TCP object into a server object; 279method that turns a TCP object into a server object;
278 280
279<li> <tt>socket.time</tt> became <tt>socket.gettime</tt> for uniformity; 281<li> <tt>socket.time</tt> changed to <tt>socket.gettime</tt> for uniformity;
280 282
281<li> Interface to options has changed. 283<li> Interface to options has changed.
282 284
diff --git a/doc/introduction.html b/doc/introduction.html
index 2c738d6..6468148 100644
--- a/doc/introduction.html
+++ b/doc/introduction.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: Introduction to the core">
7<meta name="keywords" content="Lua, Library, TCP, UDP, Network, Support">
8<title>LuaSocket: Introduction to the core</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -209,7 +211,7 @@ print("Please telnet to localhost on port " .. port)
209print("After connecting, you have 10s to enter a line to be echoed") 211print("After connecting, you have 10s to enter a line to be echoed")
210-- loop forever waiting for clients 212-- loop forever waiting for clients
211while 1 do 213while 1 do
212 -- wait for a conection from any client 214 -- wait for a connection from any client
213 local client = server:accept() 215 local client = server:accept()
214 -- make sure we don't block waiting for this client's line 216 -- make sure we don't block waiting for this client's line
215 client:settimeout(10) 217 client:settimeout(10)
diff --git a/doc/ltn12.html b/doc/ltn12.html
index bfb9b51..40dcf96 100644
--- a/doc/ltn12.html
+++ b/doc/ltn12.html
@@ -3,7 +3,10 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: LTN12 support">
7<meta name="keywords" content="Lua, Library, Filters, Source, Sink,
8Pump, Support">
9<title>LuaSocket: LTN12 module</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 10<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 11</head>
9 12
@@ -16,7 +19,7 @@
16<center> 19<center>
17<table summary="LuaSocket logo"> 20<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 21<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 22<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 23</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 24<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 25</td></tr>
diff --git a/doc/mime.html b/doc/mime.html
index 0f4ffa8..6758a4b 100644
--- a/doc/mime.html
+++ b/doc/mime.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: MIME support">
7<meta name="keywords" content="Lua, Library, MIME, Support">
8<title>LuaSocket: MIME module</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -92,7 +94,7 @@ The function returns a filter that performs the conversion.
92Note: There is no perfect solution to this problem. Different end-of-line 94Note: There is no perfect solution to this problem. Different end-of-line
93markers are an evil that will probably plague developers forever. 95markers are an evil that will probably plague developers forever.
94This function, however, will work perfectly for text created with any of 96This function, however, will work perfectly for text created with any of
95the most common end-of-line markers, i.e. the MacOS (CR), the Unix (LF), 97the most common end-of-line markers, i.e. the Mac OS (CR), the Unix (LF),
96or the DOS (CRLF) conventions. Even if the data has mixed end-of-line 98or the DOS (CRLF) conventions. Even if the data has mixed end-of-line
97markers, the function will still work well, although it doesn't 99markers, the function will still work well, although it doesn't
98guarantee that the number of empty lines will be correct. 100guarantee that the number of empty lines will be correct.
diff --git a/doc/reference.html b/doc/reference.html
index 5c07c4d..8d129e3 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language </title> 6<meta name="description" content="LuaSocket: Index to reference manual">
7<meta name="keywords" content="Lua, Library, Index, Manual, Network, Support">
8<title>LuaSocket: Index to reference manual</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
diff --git a/doc/smtp.html b/doc/smtp.html
index 224dde3..b975045 100644
--- a/doc/smtp.html
+++ b/doc/smtp.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: SMTP support">
7<meta name="keywords" content="Lua, Library, SMTP, e-mail, MIME, Multipart, Support">
8<title>LuaSocket: SMTP support</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -48,7 +50,7 @@ control (if you bother to read the code).
48Another RFC of interest is <a 50Another RFC of interest is <a
49href="http://www.cs.princeton.edu/~diego/rfc/rfc2822.txt">RFC 2822</a>, 51href="http://www.cs.princeton.edu/~diego/rfc/rfc2822.txt">RFC 2822</a>,
50which governs the Internet Message Format. 52which governs the Internet Message Format.
51Multipart messages (those that contain attatchments) are part 53Multipart messages (those that contain attachments) are part
52of the MIME standard, but described mainly 54of the MIME standard, but described mainly
53in <a href="http://www.cs.princeton.edu/~diego/rfc/rfc2046.txt">RFC 55in <a href="http://www.cs.princeton.edu/~diego/rfc/rfc2046.txt">RFC
542046</a> 562046</a>
@@ -98,7 +100,7 @@ in representing them in a Lua table.
98</p> 100</p>
99 101
100<p> 102<p>
101The following constants can be set to control the default behaviour of 103The following constants can be set to control the default behavior of
102the SMTP module: 104the SMTP module:
103</p> 105</p>
104 106
@@ -256,7 +258,7 @@ mesgt = {
256 to = "Fulano da Silva &lt;fulano@example.com&gt;", 258 to = "Fulano da Silva &lt;fulano@example.com&gt;",
257 cc = '"Beltrano F. Nunes" &lt;beltrano@example.com&gt;', 259 cc = '"Beltrano F. Nunes" &lt;beltrano@example.com&gt;',
258 subject = "My first message" 260 subject = "My first message"
259 } 261 },
260 body = "I hope this works. If it does, I can send you another 1000 copies." 262 body = "I hope this works. If it does, I can send you another 1000 copies."
261} 263}
262 264
diff --git a/doc/socket.html b/doc/socket.html
index 1bbeb7f..129b134 100644
--- a/doc/socket.html
+++ b/doc/socket.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: The core namespace">
7<meta name="keywords" content="Lua, Library, socket, Network, Support">
8<title>LuaSocket: The socket namespace</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -55,6 +57,16 @@ socket.<b>bind(</b>address, port [, backlog]<b>)</b>
55</p> 57</p>
56 58
57<p class=description> 59<p class=description>
60This function is a shortcut that creates and returns a TCP server object
61bound to a local <tt>address</tt> and <tt>port</tt>, ready to
62accept client connections. Optionally,
63user can also specify the <tt>backlog</tt> argument to the
64<a href=tcp.html#listen><tt>listen</tt></a> method (defaults to 32).
65</p>
66
67<p class=note>
68Note: The server object returned will have the option "<tt>reuseaddr</tt>"
69set to <tt><b>true</b></tt>.
58</p> 70</p>
59 71
60<!-- connect ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 72<!-- connect ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -64,9 +76,9 @@ socket.<b>connect(</b>address, port [, locaddr, locport]<b>)</b>
64</p> 76</p>
65 77
66<p class=description> 78<p class=description>
67This function is a shortcut that creates and returns a TCP socket object 79This function is a shortcut that creates and returns a TCP client object
68connected to a remote <tt>host</tt> at a given <tt>port</tt>. Optionally, 80connected to a remote <tt>host</tt> at a given <tt>port</tt>. Optionally,
69the use can also specify the local address and port to bind 81the user can also specify the local address and port to bind
70(<tt>locaddr</tt> and </tt>locport</tt>). 82(<tt>locaddr</tt> and </tt>locport</tt>).
71</p> 83</p>
72 84
diff --git a/doc/tcp.html b/doc/tcp.html
index 37b0b56..5c0da75 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: The TCP/IP support">
7<meta name="keywords" content="Lua, Library, socket, TCP, Network, Support">
8<title>LuaSocket: TCP/IP support</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -74,7 +76,7 @@ reported by <b><tt>nil</tt></b> followed by a message describing the error.
74</p> 76</p>
75 77
76<p class=note> 78<p class=note>
77Note: calling <a href=sockett.html#select><tt>socket.select</tt></a> 79Note: calling <a href=socket.html#select><tt>socket.select</tt></a>
78with a server object in 80with a server object in
79the <tt>receive</tt> parameter before a call to <tt>accept</tt> does 81the <tt>receive</tt> parameter before a call to <tt>accept</tt> does
80<em>not</em> guarantee <tt>accept</tt> will return immediately. Use the <a 82<em>not</em> guarantee <tt>accept</tt> will return immediately. Use the <a
@@ -107,7 +109,7 @@ method returns <b><tt>nil</tt></b> followed by an error message.
107</p> 109</p>
108 110
109<p class=note> 111<p class=note>
110Note: The function <a href=#socket.bind><tt>socket.bind</tt></a> 112Note: The function <a href=socket.html#bind><tt>socket.bind</tt></a>
111is available and is a shortcut for the creation server sockets. 113is available and is a shortcut for the creation server sockets.
112</p> 114</p>
113 115
@@ -163,15 +165,15 @@ describing the error. In case of success, the method returns 1.
163</p> 165</p>
164 166
165<p class=note> 167<p class=note>
166Note: The function <a href=#socket.connect><tt>socket.connect</tt></a> 168Note: The function <a href=socket.html#connect><tt>socket.connect</tt></a>
167is available and is a shortcut for the creation of client sockets. 169is available and is a shortcut for the creation of client sockets.
168</p> 170</p>
169 171
170<p class=note> 172<p class=note>
171Note: Starting with LuaSocket 2.0, 173Note: Starting with LuaSocket 2.0,
172the <a href=#settimeout><tt>settimeout</tt></a> 174the <a href=#settimeout><tt>settimeout</tt></a>
173function affects the behavior of connect, causing it to return in case of 175method affects the behavior of connect, causing it to return in case of
174a timeout error. 176a timeout.
175</p> 177</p>
176 178
177<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 179<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -197,6 +199,7 @@ Note: It makes no sense to call this method on server objects.
197<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 199<!-- getpeername ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
198 200
199<p class=name id=getsockname> 201<p class=name id=getsockname>
202master:<b>getsockname()</b><br>
200client:<b>getsockname()</b><br> 203client:<b>getsockname()</b><br>
201server:<b>getsockname()</b> 204server:<b>getsockname()</b>
202</p> 205</p>
diff --git a/doc/udp.html b/doc/udp.html
index 69895ce..75d1d9e 100644
--- a/doc/udp.html
+++ b/doc/udp.html
@@ -1,10 +1,14 @@
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<head> 5<head>
5<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: The UDP support">
7<meta name="keywords" content="Lua, Library, socket, UDP, Network, Support">
8<title>LuaSocket: UDP support</title>
6<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
7</head> 10</head>
11
8<body> 12<body>
9 13
10<!-- header ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 14<!-- header ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
@@ -14,7 +18,7 @@
14<center> 18<center>
15<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
16<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
17<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
18</a></td></tr> 22</a></td></tr>
19<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
20</td></tr> 24</td></tr>
@@ -240,7 +244,7 @@ unconnected:<b>setpeername(</b>address, port<b>)</b>
240<p class="description"> 244<p class="description">
241Changes the peer of a UDP object. This 245Changes the peer of a UDP object. This
242method turns an unconnected UDP object into a connected UDP 246method turns an unconnected UDP object into a connected UDP
243object or vice-versa. 247object or vice versa.
244</p> 248</p>
245 249
246<p class="description"> 250<p class="description">
diff --git a/doc/url.html b/doc/url.html
index 207995c..92acf36 100644
--- a/doc/url.html
+++ b/doc/url.html
@@ -3,7 +3,9 @@
3<html> 3<html>
4 4
5<head> 5<head>
6<title>LuaSocket: Network support for the Lua language</title> 6<meta name="description" content="LuaSocket: URL manipulation">
7<meta name="keywords" content="Lua, Library, URL, link, Network, Support">
8<title>LuaSocket: URL support</title>
7<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
8</head> 10</head>
9 11
@@ -16,7 +18,7 @@
16<center> 18<center>
17<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
18<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align=center><a href="http://www.lua.org">
19<img width=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png">
20</a></td></tr> 22</a></td></tr>
21<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align=center valign=top>Network support for the Lua language
22</td></tr> 24</td></tr>
@@ -135,7 +137,7 @@ Rebuilds an URL from its parts.
135<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
136<a href="#parse"><tt>parse</tt></a>. 138<a href="#parse"><tt>parse</tt></a>.
137Lower level components, if specified, 139Lower level components, if specified,
138take precedence over hight level components of the URL grammar. 140take precedence over high level components of the URL grammar.
139</p> 141</p>
140 142
141<p class=return> 143<p class=return>
@@ -279,8 +281,8 @@ Breaks a <tt>&lt;path&gt;</tt> URL component into all its
279<p class=return> 281<p class=return>
280Since some characters are reserved in URLs, they must be escaped 282Since some characters are reserved in URLs, they must be escaped
281whenever present in a <tt>&lt;path&gt;</tt> component. Therefore, before 283whenever present in a <tt>&lt;path&gt;</tt> component. Therefore, before
282returning a list with all the parsed segments, the function unescapes all 284returning a list with all the parsed segments, the function removes
283of them. 285escaping from all of them.
284</p> 286</p>
285 287
286<!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 288<!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
diff --git a/samples/cddb.lua b/samples/cddb.lua
index aefa04e..daa5df1 100644
--- a/samples/cddb.lua
+++ b/samples/cddb.lua
@@ -1,5 +1,5 @@
1socket = require("socket") 1local socket = require("socket")
2http = require("http") 2local http = require("http")
3 3
4if not arg or not arg[1] or not arg[2] then 4if not arg or not arg[1] or not arg[2] then
5 print("luasocket cddb.lua <category> <disc-id> [<server>]") 5 print("luasocket cddb.lua <category> <disc-id> [<server>]")
diff --git a/samples/daytimeclnt.lua b/samples/daytimeclnt.lua
index b4075e9..6a26ffc 100644
--- a/samples/daytimeclnt.lua
+++ b/samples/daytimeclnt.lua
@@ -4,7 +4,7 @@
4-- Author: Diego Nehab 4-- Author: Diego Nehab
5-- RCS ID: $Id$ 5-- RCS ID: $Id$
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7require"socket" 7local socket = require"socket"
8host = host or "127.0.0.1" 8host = host or "127.0.0.1"
9port = port or 13 9port = port or 13
10if arg then 10if arg then
diff --git a/samples/echosrvr.lua b/samples/echosrvr.lua
index 73bf374..3ebbe85 100644
--- a/samples/echosrvr.lua
+++ b/samples/echosrvr.lua
@@ -4,7 +4,7 @@
4-- Author: Diego Nehab 4-- Author: Diego Nehab
5-- RCS ID: $Id$ 5-- RCS ID: $Id$
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7socket = require("socket") 7local socket = require("socket")
8host = host or "127.0.0.1" 8host = host or "127.0.0.1"
9port = port or 7 9port = port or 7
10if arg then 10if arg then
diff --git a/samples/talker.lua b/samples/talker.lua
index bafd021..3f6e69c 100644
--- a/samples/talker.lua
+++ b/samples/talker.lua
@@ -4,7 +4,7 @@
4-- Author: Diego Nehab 4-- Author: Diego Nehab
5-- RCS ID: $Id$ 5-- RCS ID: $Id$
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7socket = require("socket") 7local socket = require("socket")
8host = host or "localhost" 8host = host or "localhost"
9port = port or 8080 9port = port or 8080
10if arg then 10if arg then
diff --git a/samples/tinyirc.lua b/samples/tinyirc.lua
index 85ebe29..13f42ec 100644
--- a/samples/tinyirc.lua
+++ b/samples/tinyirc.lua
@@ -4,7 +4,7 @@
4-- Author: Diego Nehab 4-- Author: Diego Nehab
5-- RCS ID: $Id$ 5-- RCS ID: $Id$
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7socket = require("socket") 7local socket = require("socket")
8host = host or "*" 8host = host or "*"
9port1 = port1 or 8080 9port1 = port1 or 8080
10port2 = port2 or 8181 10port2 = port2 or 8181
diff --git a/src/http.lua b/src/http.lua
index 9c568bc..cdb435d 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -22,8 +22,6 @@ TIMEOUT = 60
22PORT = 80 22PORT = 80
23-- user agent field sent in request 23-- user agent field sent in request
24USERAGENT = socket.VERSION 24USERAGENT = socket.VERSION
25-- block size used in transfers
26BLOCKSIZE = 2048
27 25
28----------------------------------------------------------------------------- 26-----------------------------------------------------------------------------
29-- Low level HTTP API 27-- Low level HTTP API
diff --git a/src/luasocket.h b/src/luasocket.h
index 6d30605..35dc3d9 100644
--- a/src/luasocket.h
+++ b/src/luasocket.h
@@ -25,7 +25,10 @@
25/*-------------------------------------------------------------------------*\ 25/*-------------------------------------------------------------------------*\
26* Initializes the library. 26* Initializes the library.
27\*-------------------------------------------------------------------------*/ 27\*-------------------------------------------------------------------------*/
28#ifndef LUASOCKET_LIBNAME
28#define LUASOCKET_LIBNAME "socket" 29#define LUASOCKET_LIBNAME "socket"
30#endif
31
29LUASOCKET_API int luaopen_socket(lua_State *L); 32LUASOCKET_API int luaopen_socket(lua_State *L);
30 33
31#endif /* LUASOCKET_H */ 34#endif /* LUASOCKET_H */
diff --git a/src/mime.h b/src/mime.h
index be16920..ad8a573 100644
--- a/src/mime.h
+++ b/src/mime.h
@@ -19,7 +19,10 @@
19#define MIME_API extern 19#define MIME_API extern
20#endif 20#endif
21 21
22#ifndef MIME_LIBNAME
22#define MIME_LIBNAME "mime" 23#define MIME_LIBNAME "mime"
24#endif
25
23MIME_API int luaopen_mime(lua_State *L); 26MIME_API int luaopen_mime(lua_State *L);
24 27
25#endif /* MIME_H */ 28#endif /* MIME_H */
diff --git a/src/mime.lua b/src/mime.lua
index 345bd25..fcdc358 100644
--- a/src/mime.lua
+++ b/src/mime.lua
@@ -12,9 +12,9 @@ local mime = requirelib("mime", "luaopen_mime", getfenv(1))
12local ltn12 = require("ltn12") 12local ltn12 = require("ltn12")
13 13
14-- encode, decode and wrap algorithm tables 14-- encode, decode and wrap algorithm tables
15encodet = {} 15mime.encodet = {}
16decodet = {} 16mime.decodet = {}
17wrapt = {} 17mime.wrapt = {}
18 18
19-- creates a function that chooses a filter by name from a given table 19-- creates a function that chooses a filter by name from a given table
20local function choose(table) 20local function choose(table)
@@ -29,47 +29,47 @@ local function choose(table)
29end 29end
30 30
31-- define the encoding filters 31-- define the encoding filters
32encodet['base64'] = function() 32mime.encodet['base64'] = function()
33 return ltn12.filter.cycle(b64, "") 33 return ltn12.filter.cycle(b64, "")
34end 34end
35 35
36encodet['quoted-printable'] = function(mode) 36mime.encodet['quoted-printable'] = function(mode)
37 return ltn12.filter.cycle(qp, "", 37 return ltn12.filter.cycle(qp, "",
38 (mode == "binary") and "=0D=0A" or "\r\n") 38 (mode == "binary") and "=0D=0A" or "\r\n")
39end 39end
40 40
41-- define the decoding filters 41-- define the decoding filters
42decodet['base64'] = function() 42mime.decodet['base64'] = function()
43 return ltn12.filter.cycle(unb64, "") 43 return ltn12.filter.cycle(unb64, "")
44end 44end
45 45
46decodet['quoted-printable'] = function() 46mime.decodet['quoted-printable'] = function()
47 return ltn12.filter.cycle(unqp, "") 47 return ltn12.filter.cycle(unqp, "")
48end 48end
49 49
50-- define the line-wrap filters 50-- define the line-wrap filters
51wrapt['text'] = function(length) 51mime.wrapt['text'] = function(length)
52 length = length or 76 52 length = length or 76
53 return ltn12.filter.cycle(wrp, length, length) 53 return ltn12.filter.cycle(wrp, length, length)
54end 54end
55wrapt['base64'] = wrapt['text'] 55mime.wrapt['base64'] = wrapt['text']
56wrapt['default'] = wrapt['text'] 56mime.wrapt['default'] = wrapt['text']
57 57
58wrapt['quoted-printable'] = function() 58mime.wrapt['quoted-printable'] = function()
59 return ltn12.filter.cycle(qpwrp, 76, 76) 59 return ltn12.filter.cycle(qpwrp, 76, 76)
60end 60end
61 61
62-- function that choose the encoding, decoding or wrap algorithm 62-- function that choose the encoding, decoding or wrap algorithm
63encode = choose(encodet) 63mime.encode = choose(encodet)
64decode = choose(decodet) 64mime.decode = choose(decodet)
65wrap = choose(wrapt) 65mime.wrap = choose(wrapt)
66 66
67-- define the end-of-line normalization filter 67-- define the end-of-line normalization filter
68function normalize(marker) 68function mime.normalize(marker)
69 return ltn12.filter.cycle(eol, 0, marker) 69 return ltn12.filter.cycle(eol, 0, marker)
70end 70end
71 71
72-- high level stuffing filter 72-- high level stuffing filter
73function stuff() 73function mime.stuff()
74 return ltn12.filter.cycle(dot, 2) 74 return ltn12.filter.cycle(dot, 2)
75end 75end
diff --git a/src/socket.lua b/src/socket.lua
index 4d64651..b3889d7 100644
--- a/src/socket.lua
+++ b/src/socket.lua
@@ -8,7 +8,6 @@
8-- Load LuaSocket from dynamic library 8-- Load LuaSocket from dynamic library
9----------------------------------------------------------------------------- 9-----------------------------------------------------------------------------
10local socket = requirelib("luasocket", "luaopen_socket", getfenv(1)) 10local socket = requirelib("luasocket", "luaopen_socket", getfenv(1))
11_LOADED["socket"] = socket
12 11
13----------------------------------------------------------------------------- 12-----------------------------------------------------------------------------
14-- Auxiliar functions 13-- Auxiliar functions
@@ -31,7 +30,7 @@ function socket.bind(host, port, backlog)
31 sock:setoption("reuseaddr", true) 30 sock:setoption("reuseaddr", true)
32 local res, err = sock:bind(host, port) 31 local res, err = sock:bind(host, port)
33 if not res then return nil, err end 32 if not res then return nil, err end
34 backlog = backlog or 1 33 backlog = backlog or 32
35 res, err = sock:listen(backlog) 34 res, err = sock:listen(backlog)
36 if not res then return nil, err end 35 if not res then return nil, err end
37 return sock 36 return sock
diff --git a/src/tcp.c b/src/tcp.c
index adc2585..cbfebdb 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -130,7 +130,7 @@ static int meth_setoption(lua_State *L)
130static int meth_getfd(lua_State *L) 130static int meth_getfd(lua_State *L)
131{ 131{
132 p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1); 132 p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1);
133 lua_pushnumber(L, tcp->sock); 133 lua_pushnumber(L, (int) tcp->sock);
134 return 1; 134 return 1;
135} 135}
136 136
@@ -164,6 +164,7 @@ static int meth_accept(lua_State *L)
164 p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp)); 164 p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp));
165 aux_setclass(L, "tcp{client}", -1); 165 aux_setclass(L, "tcp{client}", -1);
166 /* initialize structure fields */ 166 /* initialize structure fields */
167 sock_setnonblocking(&sock);
167 clnt->sock = sock; 168 clnt->sock = sock;
168 io_init(&clnt->io, (p_send)sock_send, (p_recv)sock_recv, &clnt->sock); 169 io_init(&clnt->io, (p_send)sock_send, (p_recv)sock_recv, &clnt->sock);
169 tm_init(&clnt->tm, -1, -1); 170 tm_init(&clnt->tm, -1, -1);
@@ -310,10 +311,11 @@ static int global_create(lua_State *L)
310 if (!err) { 311 if (!err) {
311 /* allocate tcp object */ 312 /* allocate tcp object */
312 p_tcp tcp = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); 313 p_tcp tcp = (p_tcp) lua_newuserdata(L, sizeof(t_tcp));
313 tcp->sock = sock;
314 /* set its type as master object */ 314 /* set its type as master object */
315 aux_setclass(L, "tcp{master}", -1); 315 aux_setclass(L, "tcp{master}", -1);
316 /* initialize remaining structure fields */ 316 /* initialize remaining structure fields */
317 sock_setnonblocking(&sock);
318 tcp->sock = sock;
317 io_init(&tcp->io, (p_send) sock_send, (p_recv) sock_recv, &tcp->sock); 319 io_init(&tcp->io, (p_send) sock_send, (p_recv) sock_recv, &tcp->sock);
318 tm_init(&tcp->tm, -1, -1); 320 tm_init(&tcp->tm, -1, -1);
319 buf_init(&tcp->buf, &tcp->io, &tcp->tm); 321 buf_init(&tcp->buf, &tcp->io, &tcp->tm);
diff --git a/src/udp.c b/src/udp.c
index 512cc0b..d20d61b 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -208,7 +208,7 @@ static int meth_receivefrom(lua_State *L)
208static int meth_getfd(lua_State *L) 208static int meth_getfd(lua_State *L)
209{ 209{
210 p_udp udp = (p_udp) aux_checkgroup(L, "udp{any}", 1); 210 p_udp udp = (p_udp) aux_checkgroup(L, "udp{any}", 1);
211 lua_pushnumber(L, udp->sock); 211 lua_pushnumber(L, (int) udp->sock);
212 return 1; 212 return 1;
213} 213}
214 214
@@ -328,10 +328,10 @@ static int global_create(lua_State *L)
328 if (!err) { 328 if (!err) {
329 /* allocate tcp object */ 329 /* allocate tcp object */
330 p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); 330 p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp));
331 udp->sock = sock;
332 /* set its type as master object */
333 aux_setclass(L, "udp{unconnected}", -1); 331 aux_setclass(L, "udp{unconnected}", -1);
334 /* initialize remaining structure fields */ 332 /* initialize remaining structure fields */
333 sock_setnonblocking(&sock);
334 udp->sock = sock;
335 tm_init(&udp->tm, -1, -1); 335 tm_init(&udp->tm, -1, -1);
336 return 1; 336 return 1;
337 } else { 337 } else {
diff --git a/src/usocket.c b/src/usocket.c
index ea0f172..617b1ea 100644
--- a/src/usocket.c
+++ b/src/usocket.c
@@ -81,7 +81,6 @@ const char *sock_create(p_sock ps, int domain, int type, int protocol)
81 t_sock sock = socket(domain, type, protocol); 81 t_sock sock = socket(domain, type, protocol);
82 if (sock == SOCK_INVALID) return sock_createstrerror(errno); 82 if (sock == SOCK_INVALID) return sock_createstrerror(errno);
83 *ps = sock; 83 *ps = sock;
84 sock_setnonblocking(ps);
85 return NULL; 84 return NULL;
86} 85}
87 86
@@ -178,10 +177,7 @@ const char *sock_accept(p_sock ps, p_sock pa, SA *addr,
178 do *pa = accept(sock, addr, addr_len); 177 do *pa = accept(sock, addr, addr_len);
179 while (*pa < 0 && errno == EINTR); 178 while (*pa < 0 && errno == EINTR);
180 /* if result is valid, we are done */ 179 /* if result is valid, we are done */
181 if (*pa != SOCK_INVALID) { 180 if (*pa != SOCK_INVALID) return NULL;
182 sock_setnonblocking(pa);
183 return NULL;
184 }
185 /* find out if we failed for a fatal reason */ 181 /* find out if we failed for a fatal reason */
186 if (errno != EWOULDBLOCK && errno != ECONNABORTED) 182 if (errno != EWOULDBLOCK && errno != ECONNABORTED)
187 return sock_acceptstrerror(errno); 183 return sock_acceptstrerror(errno);
diff --git a/src/wsocket.c b/src/wsocket.c
index 84a49dc..e276fe0 100644
--- a/src/wsocket.c
+++ b/src/wsocket.c
@@ -88,7 +88,6 @@ const char *sock_create(p_sock ps, int domain, int type, int protocol)
88 if (sock == SOCK_INVALID) 88 if (sock == SOCK_INVALID)
89 return sock_createstrerror(WSAGetLastError()); 89 return sock_createstrerror(WSAGetLastError());
90 *ps = sock; 90 *ps = sock;
91 sock_setnonblocking(ps);
92 return NULL; 91 return NULL;
93} 92}
94 93
@@ -177,10 +176,7 @@ const char *sock_accept(p_sock ps, p_sock pa, SA *addr,
177 /* try to get client socket */ 176 /* try to get client socket */
178 *pa = accept(sock, addr, addr_len); 177 *pa = accept(sock, addr, addr_len);
179 /* if return is valid, we are done */ 178 /* if return is valid, we are done */
180 if (*pa != SOCK_INVALID) { 179 if (*pa != SOCK_INVALID) return NULL;
181 sock_setnonblocking(pa);
182 return NULL;
183 }
184 /* optimization */ 180 /* optimization */
185 if (timeout == 0) return io_strerror(IO_TIMEOUT); 181 if (timeout == 0) return io_strerror(IO_TIMEOUT);
186 /* otherwise find out why we failed */ 182 /* otherwise find out why we failed */
diff --git a/test/httptest.lua b/test/httptest.lua
index ea8465d..3a4d461 100644
--- a/test/httptest.lua
+++ b/test/httptest.lua
@@ -4,11 +4,11 @@
4-- to "/luasocket-test-cgi" and "/luasocket-test-cgi/" 4-- to "/luasocket-test-cgi" and "/luasocket-test-cgi/"
5-- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth 5-- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth
6 6
7socket = require("socket") 7local socket = require("socket")
8http = require("http") 8local http = require("http")
9mime = require("mime") 9local mime = require("mime")
10url = require("url") 10local url = require("url")
11ltn12 = require("ltn12") 11local ltn12 = require("ltn12")
12 12
13dofile("testsupport.lua") 13dofile("testsupport.lua")
14 14
diff --git a/test/mimetest.lua b/test/mimetest.lua
index f51c3b8..685c610 100644
--- a/test/mimetest.lua
+++ b/test/mimetest.lua
@@ -8,7 +8,7 @@ local qptest = "qptest.bin"
8local eqptest = "qptest.bin2" 8local eqptest = "qptest.bin2"
9local dqptest = "qptest.bin3" 9local dqptest = "qptest.bin3"
10 10
11local b64test = "luasocket.dll" 11local b64test = "luasocket.dylib"
12local eb64test = "b64test.bin" 12local eb64test = "b64test.bin"
13local db64test = "b64test.bin2" 13local db64test = "b64test.bin2"
14 14
diff --git a/test/stufftest.lua b/test/stufftest.lua
index eddf636..490053f 100644
--- a/test/stufftest.lua
+++ b/test/stufftest.lua
@@ -1,4 +1,4 @@
1mime = require("mime") 1local mime = require("mime")
2 2
3function test_dot(original, right) 3function test_dot(original, right)
4 local result, n = mime.dot(2, original) 4 local result, n = mime.dot(2, original)
diff --git a/test/testclnt.lua b/test/testclnt.lua
index 1b20ad1..9aa07fe 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -1,4 +1,4 @@
1socket = require"socket" 1local socket = require"socket"
2 2
3host = host or "localhost" 3host = host or "localhost"
4port = port or "8080" 4port = port or "8080"
@@ -418,7 +418,7 @@ function connect_errors()
418 assert(not c and e == "connection refused", e) 418 assert(not c and e == "connection refused", e)
419 print("ok") 419 print("ok")
420 io.stderr:write("host not found: ") 420 io.stderr:write("host not found: ")
421 local c, e = socket.connect("not.exist.com", 1); 421 local c, e = socket.connect("host.is.invalid", 1);
422 assert(not c and e == "host not found", e) 422 assert(not c and e == "host not found", e)
423 print("ok") 423 print("ok")
424end 424end
diff --git a/test/testsrvr.lua b/test/testsrvr.lua
index 5b842f1..71281cf 100644
--- a/test/testsrvr.lua
+++ b/test/testsrvr.lua
@@ -1,4 +1,4 @@
1socket = require"socket" 1local socket = require"socket"
2 2
3host = host or "localhost" 3host = host or "localhost"
4port = port or "8080" 4port = port or "8080"
diff --git a/test/urltest.lua b/test/urltest.lua
index 92f2fae..eb15bcf 100644
--- a/test/urltest.lua
+++ b/test/urltest.lua
@@ -1,4 +1,4 @@
1socket = require("socket") 1local socket = require("socket")
2socket.url = require("url") 2socket.url = require("url")
3dofile("testsupport.lua") 3dofile("testsupport.lua")
4 4