diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2012-04-23 00:18:45 +0800 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2012-04-23 00:18:45 +0800 |
commit | f960b3872a668ed1b53bd50c5b6a708367332f3c (patch) | |
tree | e82a1b113ed40d70afae36d230b6a6048e1d9fab | |
parent | f37e0260261f7691246429d227cf7124c291e8b1 (diff) | |
download | luasocket-f960b3872a668ed1b53bd50c5b6a708367332f3c.tar.gz luasocket-f960b3872a668ed1b53bd50c5b6a708367332f3c.tar.bz2 luasocket-f960b3872a668ed1b53bd50c5b6a708367332f3c.zip |
Making progress toward a release
Documented headers.lua
Update copyright date everywhere
Remove RCSID from files
Move version back to 2.1 rather than 2.1.1
Fixed url package to support ipv6 hosts
Changed "domain" to "family" in tcp and udp structures
Implemented getfamily methods
53 files changed, 236 insertions, 108 deletions
@@ -1,5 +1,5 @@ | |||
1 | LuaSocket 2.0.2 license | 1 | LuaSocket 2.1 license |
2 | Copyright © 2004-2007 Diego Nehab | 2 | Copyright © 2004-2012 Diego Nehab |
3 | 3 | ||
4 | Permission is hereby granted, free of charge, to any person obtaining a | 4 | Permission is hereby granted, free of charge, to any person obtaining a |
5 | copy of this software and associated documentation files (the "Software"), | 5 | copy of this software and associated documentation files (the "Software"), |
@@ -1,4 +1,4 @@ | |||
1 | This is the LuaSocket 2.1.1. It has been tested on --[[WinXP--]], Mac OS X, | 1 | This is the LuaSocket 2.1. It has been tested on --[[WinXP--]], Mac OS X, |
2 | and --[[Linux--]]. Please use the Lua mailing list to report any bugs | 2 | and --[[Linux--]]. Please use the Lua mailing list to report any bugs |
3 | (or "features") you encounter. | 3 | (or "features") you encounter. |
4 | 4 | ||
@@ -1,39 +1,40 @@ | |||
1 | - merge luaL_typeerror into auxiliar to avoid using luaL prefix? | ||
2 | - getsockname should also support IPv6, no? | 1 | - getsockname should also support IPv6, no? |
3 | - remove RCSID from files? | ||
4 | - shouldn't we instead make the code compatible to Lua 5.2 | 2 | - shouldn't we instead make the code compatible to Lua 5.2 |
5 | without any compat stuff, and use a compatibility layer to | 3 | without any compat stuff, and use a compatibility layer to |
6 | make it work on 5.1? | 4 | make it work on 5.1? |
7 | - why 2.1.1 rather than 2.1? | ||
8 | - add what's new to manual | 5 | - add what's new to manual |
9 | - should there be an equivalent to tohostname for IPv6? | 6 | - should there be an equivalent to tohostname for IPv6? |
10 | - should we add service name resolution as well to | 7 | - should we add service name resolution as well to getaddrinfo? |
11 | getaddrinfo? | ||
12 | - document bind and connect behavior based on address? | 8 | - document bind and connect behavior based on address? |
13 | 9 | ||
14 | - add functionality to query if object is ipv4 or 6? | ||
15 | - update copyright date everywhere? | ||
16 | - what to do about author? | ||
17 | - add http POST sample to manual | 10 | - add http POST sample to manual |
18 | people keep asking stupid questions | 11 | people keep asking stupid questions |
19 | - documentation of dirty/getfd/setfd is problematic because of portability | 12 | - documentation of dirty/getfd/setfd is problematic because of portability |
20 | same for unix and serial. | 13 | same for unix and serial. |
21 | what to do about this? add a stronger disclaimer? | 14 | what to do about this? add a stronger disclaimer? |
22 | - remove references to Lua 5.0 from documentation, add 5.2? | ||
23 | - update lua and luasocket version in samples in documentation | ||
24 | - document headers.lua? | ||
25 | - fix makefile with decent defaults? | 15 | - fix makefile with decent defaults? |
26 | 16 | ||
27 | Done: | 17 | Done: |
28 | 18 | ||
19 | - document headers.lua? | ||
20 | - update copyright date everywhere? | ||
21 | - remove RCSID from files? | ||
22 | - move version to 2.1 rather than 2.1.1? | ||
23 | - fixed url package to support ipv6 hosts | ||
24 | - changed domain to family | ||
25 | - implement getfamily methods. | ||
26 | |||
27 | - remove references to Lua 5.0 from documentation, add 5.2? | ||
28 | - update lua and luasocket version in samples in documentation | ||
29 | - document ipv5_v6only default option being set? | 29 | - document ipv5_v6only default option being set? |
30 | - document tcp6 and udp6 | 30 | - document tcp6 and udp6 |
31 | - document dns.getaddrinfo | 31 | - document dns.getaddrinfo |
32 | - document zero-sized send on udp vs. tcp? | 32 | - documented zero-sized datagram change? |
33 | no. | 33 | no. |
34 | - document unix socket and serial socket? add raw support? | 34 | - document unix socket and serial socket? add raw support? |
35 | no. | 35 | no. |
36 | - document getoption | 36 | - document getoption |
37 | - merge luaL_typeerror into auxiliar to avoid using luaL prefix? | ||
37 | 38 | ||
38 | 39 | ||
39 | 40 | ||
diff --git a/doc/http.html b/doc/http.html index 9f3f087..cd41c0d 100644 --- a/doc/http.html +++ b/doc/http.html | |||
@@ -95,8 +95,9 @@ headers = {<br> | |||
95 | </blockquote> | 95 | </blockquote> |
96 | 96 | ||
97 | <p> | 97 | <p> |
98 | Field names are case insensitive (as specified by the standard) and all | 98 | Field names are case insensitive (as specified by the standard) and all |
99 | functions work with lowercase field names. | 99 | functions work with lowercase field names (but see |
100 | <a href=socket.html#headers.canonic><tt>socket.headers.canonic</tt></a>). | ||
100 | Field values are left unmodified. | 101 | Field values are left unmodified. |
101 | </p> | 102 | </p> |
102 | 103 | ||
@@ -117,6 +118,7 @@ the HTTP module: | |||
117 | <li> <tt>USERAGENT</tt>: default user agent reported to server. | 118 | <li> <tt>USERAGENT</tt>: default user agent reported to server. |
118 | </ul> | 119 | </ul> |
119 | 120 | ||
121 | |||
120 | <!-- http.request ++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 122 | <!-- http.request ++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
121 | 123 | ||
122 | <p class=name id="request"> | 124 | <p class=name id="request"> |
diff --git a/doc/index.html b/doc/index.html index 9da0f3c..833c9a8 100644 --- a/doc/index.html +++ b/doc/index.html | |||
@@ -87,7 +87,7 @@ Author: <A href="http://www.impa.br/~diego">Diego Nehab</a> | |||
87 | <h2 id=download>Download</h2> | 87 | <h2 id=download>Download</h2> |
88 | 88 | ||
89 | <p> | 89 | <p> |
90 | LuaSocket version 2.1.1-rc1 is now available for download! | 90 | LuaSocket version 2.1-rc1 is now available for download! |
91 | It is compatible with Lua 5.1 and 5.2, and has | 91 | It is compatible with Lua 5.1 and 5.2, and has |
92 | been tested on Windows XP, Linux, and Mac OS X. Chances | 92 | been tested on Windows XP, Linux, and Mac OS X. Chances |
93 | are it works well on most UNIX distributions and Windows flavors. | 93 | are it works well on most UNIX distributions and Windows flavors. |
@@ -125,7 +125,7 @@ has helped bring this library back to life. | |||
125 | <h2 id=new>What's New</h2> | 125 | <h2 id=new>What's New</h2> |
126 | 126 | ||
127 | <p> | 127 | <p> |
128 | Main changes for LuaSocket 2.1.1-rc1 are IPv6 support | 128 | Main changes for LuaSocket 2.1-rc1 are IPv6 support |
129 | and Lua 5.2 compatibility. | 129 | and Lua 5.2 compatibility. |
130 | </p> | 130 | </p> |
131 | 131 | ||
@@ -135,6 +135,7 @@ and Lua 5.2 compatibility. | |||
135 | <ul> | 135 | <ul> |
136 | <li> <tt>Socket.connect</tt> and <tt>socket.bind</tt> support IPv6 addresses; | 136 | <li> <tt>Socket.connect</tt> and <tt>socket.bind</tt> support IPv6 addresses; |
137 | <li> <tt>Getpeername</tt> and <tt>getsockname</tt> support IPv6 addresses; | 137 | <li> <tt>Getpeername</tt> and <tt>getsockname</tt> support IPv6 addresses; |
138 | <li> URL module updated to support IPv6 host names; | ||
138 | <li> New <tt>socket.tcp6</tt> and <tt>socket.udp6</tt> functions; | 139 | <li> New <tt>socket.tcp6</tt> and <tt>socket.udp6</tt> functions; |
139 | <li> New <tt>socket.dns.getaddrinfo</tt> function; | 140 | <li> New <tt>socket.dns.getaddrinfo</tt> function; |
140 | </ul> | 141 | </ul> |
diff --git a/doc/installation.html b/doc/installation.html index 00b2db0..37c309b 100644 --- a/doc/installation.html +++ b/doc/installation.html | |||
@@ -39,7 +39,7 @@ Installation"> | |||
39 | 39 | ||
40 | <h2>Installation</h2> | 40 | <h2>Installation</h2> |
41 | 41 | ||
42 | <p> LuaSocket 2.1.1-rc still uses Lua 5.1's package | 42 | <p> LuaSocket 2.1-rc still uses Lua 5.1's package |
43 | system. Users that have already made the switch to | 43 | system. Users that have already made the switch to |
44 | Lua 5.2 should leave the default | 44 | Lua 5.2 should leave the default |
45 | <tt>LUA_COMPAT_MODULE</tt> defined when compiling their Lua | 45 | <tt>LUA_COMPAT_MODULE</tt> defined when compiling their Lua |
@@ -95,7 +95,7 @@ it should be easy to use LuaSocket. Just fire the interpreter and use the | |||
95 | Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio | 95 | Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio |
96 | > socket = require("socket") | 96 | > socket = require("socket") |
97 | > print(socket._VERSION) | 97 | > print(socket._VERSION) |
98 | --> LuaSocket 2.1.1-rc1 | 98 | --> LuaSocket 2.1-rc1 |
99 | </pre> | 99 | </pre> |
100 | 100 | ||
101 | <p> Each module loads their dependencies automatically, so you only need to | 101 | <p> Each module loads their dependencies automatically, so you only need to |
diff --git a/doc/reference.html b/doc/reference.html index d1043d4..f069d47 100644 --- a/doc/reference.html +++ b/doc/reference.html | |||
@@ -148,6 +148,7 @@ Support, Manual"> | |||
148 | <a href="socket.html#debug">_DEBUG</a>, | 148 | <a href="socket.html#debug">_DEBUG</a>, |
149 | <a href="dns.html#dns">dns</a>, | 149 | <a href="dns.html#dns">dns</a>, |
150 | <a href="socket.html#gettime">gettime</a>, | 150 | <a href="socket.html#gettime">gettime</a>, |
151 | <a href="socket.html#headers.canonic">headers.canonic</a>, | ||
151 | <a href="socket.html#newtry">newtry</a>, | 152 | <a href="socket.html#newtry">newtry</a>, |
152 | <a href="socket.html#protect">protect</a>, | 153 | <a href="socket.html#protect">protect</a>, |
153 | <a href="socket.html#select">select</a>, | 154 | <a href="socket.html#select">select</a>, |
diff --git a/doc/smtp.html b/doc/smtp.html index 2ef673a..bbbff80 100644 --- a/doc/smtp.html +++ b/doc/smtp.html | |||
@@ -90,8 +90,9 @@ headers = {<br> | |||
90 | </blockquote> | 90 | </blockquote> |
91 | 91 | ||
92 | <p> | 92 | <p> |
93 | Field names are case insensitive (as specified by the standard) and all | 93 | Field names are case insensitive (as specified by the standard) and all |
94 | functions work with lowercase field names. | 94 | functions work with lowercase field names (but see |
95 | <a href=socket.html#headers.canonic><tt>socket.headers.canonic</tt></a>). | ||
95 | Field values are left unmodified. | 96 | Field values are left unmodified. |
96 | </p> | 97 | </p> |
97 | 98 | ||
diff --git a/doc/socket.html b/doc/socket.html index 2267b4a..dcf8b61 100644 --- a/doc/socket.html +++ b/doc/socket.html | |||
@@ -112,6 +112,29 @@ t = socket.gettime() | |||
112 | print(socket.gettime() - t .. " seconds elapsed") | 112 | print(socket.gettime() - t .. " seconds elapsed") |
113 | </pre> | 113 | </pre> |
114 | 114 | ||
115 | <!-- socket.headers ++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
116 | |||
117 | <p class=name id="headers.canonic"> | ||
118 | socket.headers.<b>canonic</b></p> | ||
119 | |||
120 | <p> The <tt>socket.headers.canonic</tt> table | ||
121 | is used by the HTTP and SMTP modules to translate from | ||
122 | lowercase field names back into their canonic | ||
123 | capitalization. When a lowercase field name exists as a key | ||
124 | in this table, the associated value is substituted in | ||
125 | whenever the field name is sent out. | ||
126 | </p> | ||
127 | |||
128 | <p> | ||
129 | You can obtain the <tt>headers</tt> namespace if case run-time | ||
130 | modifications are required by running: | ||
131 | </p> | ||
132 | |||
133 | <pre class=example> | ||
134 | -- loads the headers module | ||
135 | local headers = require("headers") | ||
136 | </pre> | ||
137 | |||
115 | <!-- newtry +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 138 | <!-- newtry +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
116 | 139 | ||
117 | <p class=name id=newtry> | 140 | <p class=name id=newtry> |
diff --git a/etc/b64.lua b/etc/b64.lua index f75c423..11eeb2d 100644 --- a/etc/b64.lua +++ b/etc/b64.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- Little program to convert to and from Base64 | 2 | -- Little program to convert to and from Base64 |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: b64.lua,v 1.8 2004/06/16 04:28:21 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local ltn12 = require("ltn12") | 6 | local ltn12 = require("ltn12") |
8 | local mime = require("mime") | 7 | local mime = require("mime") |
diff --git a/etc/check-links.lua b/etc/check-links.lua index a989f8c..d2e4266 100644 --- a/etc/check-links.lua +++ b/etc/check-links.lua | |||
@@ -3,7 +3,6 @@ | |||
3 | -- non-blocking I/O via the dispatcher module. | 3 | -- non-blocking I/O via the dispatcher module. |
4 | -- LuaSocket sample files | 4 | -- LuaSocket sample files |
5 | -- Author: Diego Nehab | 5 | -- Author: Diego Nehab |
6 | -- RCS ID: $$ | ||
7 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
8 | local url = require("socket.url") | 7 | local url = require("socket.url") |
9 | local dispatch = require("dispatch") | 8 | local dispatch = require("dispatch") |
diff --git a/etc/dict.lua b/etc/dict.lua index e375d23..8c5b711 100644 --- a/etc/dict.lua +++ b/etc/dict.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- Little program to download DICT word definitions | 2 | -- Little program to download DICT word definitions |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: dict.lua,v 1.22 2005/11/22 08:33:29 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
diff --git a/etc/dispatch.lua b/etc/dispatch.lua index 5236f3d..cc8cb23 100644 --- a/etc/dispatch.lua +++ b/etc/dispatch.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- A hacked dispatcher module | 2 | -- A hacked dispatcher module |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $$ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local base = _G | 6 | local base = _G |
8 | local table = require("table") | 7 | local table = require("table") |
diff --git a/etc/eol.lua b/etc/eol.lua index b90be79..eeaf0ce 100644 --- a/etc/eol.lua +++ b/etc/eol.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- Little program to adjust end of line markers. | 2 | -- Little program to adjust end of line markers. |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: eol.lua,v 1.8 2005/11/22 08:33:29 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local mime = require("mime") | 6 | local mime = require("mime") |
8 | local ltn12 = require("ltn12") | 7 | local ltn12 = require("ltn12") |
diff --git a/etc/get.lua b/etc/get.lua index 4c344e2..4196f00 100644 --- a/etc/get.lua +++ b/etc/get.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- Little program to download files from URLs | 2 | -- Little program to download files from URLs |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: get.lua,v 1.25 2007/03/12 04:08:40 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require("socket") | 6 | local socket = require("socket") |
8 | local http = require("socket.http") | 7 | local http = require("socket.http") |
@@ -3,7 +3,6 @@ | |||
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: David Burgess | 4 | -- Author: David Burgess |
5 | -- Modified by Diego Nehab, but David is in charge | 5 | -- Modified by Diego Nehab, but David is in charge |
6 | -- RCS ID: $Id: lp.lua,v 1.14 2005/11/21 07:04:44 diego Exp $ | ||
7 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
8 | --[[ | 7 | --[[ |
9 | if you have any questions: RFC 1179 | 8 | if you have any questions: RFC 1179 |
@@ -2,7 +2,6 @@ | |||
2 | -- Little program to convert to and from Quoted-Printable | 2 | -- Little program to convert to and from Quoted-Printable |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: qp.lua,v 1.5 2004/06/17 21:46:22 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local ltn12 = require("ltn12") | 6 | local ltn12 = require("ltn12") |
8 | local mime = require("mime") | 7 | local mime = require("mime") |
diff --git a/etc/tftp.lua b/etc/tftp.lua index 7f51c6f..ed99cd1 100644 --- a/etc/tftp.lua +++ b/etc/tftp.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- TFTP support for the Lua language | 2 | -- TFTP support for the Lua language |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: tftp.lua,v 1.16 2005/11/22 08:33:29 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
diff --git a/makefile.dist b/makefile.dist index fbd6681..2c6137b 100644 --- a/makefile.dist +++ b/makefile.dist | |||
@@ -1,7 +1,7 @@ | |||
1 | #-------------------------------------------------------------------------- | 1 | #-------------------------------------------------------------------------- |
2 | # Distribution makefile | 2 | # Distribution makefile |
3 | #-------------------------------------------------------------------------- | 3 | #-------------------------------------------------------------------------- |
4 | DIST = luasocket-2.1.1-rc1 | 4 | DIST = luasocket-2.1-rc1 |
5 | 5 | ||
6 | TEST = \ | 6 | TEST = \ |
7 | test/README \ | 7 | test/README \ |
diff --git a/samples/daytimeclnt.lua b/samples/daytimeclnt.lua index 90ab39e..f81e37c 100644 --- a/samples/daytimeclnt.lua +++ b/samples/daytimeclnt.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- UDP sample: daytime protocol client | 2 | -- UDP sample: daytime protocol client |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: daytimeclnt.lua,v 1.11 2004/06/21 06:07:57 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require"socket" | 6 | local socket = require"socket" |
8 | host = host or "127.0.0.1" | 7 | host = host or "127.0.0.1" |
diff --git a/samples/echoclnt.lua b/samples/echoclnt.lua index 038be4c..bb22557 100644 --- a/samples/echoclnt.lua +++ b/samples/echoclnt.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- UDP sample: echo protocol client | 2 | -- UDP sample: echo protocol client |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: echoclnt.lua,v 1.10 2005/01/02 22:44:00 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require("socket") | 6 | local socket = require("socket") |
8 | host = host or "localhost" | 7 | host = host or "localhost" |
diff --git a/samples/echosrvr.lua b/samples/echosrvr.lua index 2697ca4..ea564e2 100644 --- a/samples/echosrvr.lua +++ b/samples/echosrvr.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- UDP sample: echo protocol server | 2 | -- UDP sample: echo protocol server |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: echosrvr.lua,v 1.12 2005/11/22 08:33:29 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require("socket") | 6 | local socket = require("socket") |
8 | host = host or "127.0.0.1" | 7 | host = host or "127.0.0.1" |
diff --git a/samples/listener.lua b/samples/listener.lua index 9260fbb..77db2d5 100644 --- a/samples/listener.lua +++ b/samples/listener.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- TCP sample: Little program to dump lines received at a given port | 2 | -- TCP sample: Little program to dump lines received at a given port |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: listener.lua,v 1.11 2005/01/02 22:44:00 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require("socket") | 6 | local socket = require("socket") |
8 | host = host or "*" | 7 | host = host or "*" |
diff --git a/samples/talker.lua b/samples/talker.lua index 607ff31..d5a36cb 100644 --- a/samples/talker.lua +++ b/samples/talker.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- TCP sample: Little program to send text lines to a given host/port | 2 | -- TCP sample: Little program to send text lines to a given host/port |
3 | -- LuaSocket sample files | 3 | -- LuaSocket sample files |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: talker.lua,v 1.9 2005/01/02 22:44:00 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require("socket") | 6 | local socket = require("socket") |
8 | host = host or "localhost" | 7 | host = host or "localhost" |
diff --git a/samples/tinyirc.lua b/samples/tinyirc.lua index f474302..e75851f 100644 --- a/samples/tinyirc.lua +++ b/samples/tinyirc.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- Select sample: simple text line server | 2 | -- Select sample: simple text line server |
3 | -- LuaSocket sample files. | 3 | -- LuaSocket sample files. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: tinyirc.lua,v 1.14 2005/11/22 08:33:29 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | local socket = require("socket") | 6 | local socket = require("socket") |
8 | host = host or "*" | 7 | host = host or "*" |
diff --git a/src/auxiliar.c b/src/auxiliar.c index c4e5260..de625e9 100644 --- a/src/auxiliar.c +++ b/src/auxiliar.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Auxiliar routines for class hierarchy manipulation | 2 | * Auxiliar routines for class hierarchy manipulation |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: auxiliar.c,v 1.14 2005/10/07 04:40:59 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/src/buffer.c b/src/buffer.c index 452a579..d8facd2 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Input/Output interface for Lua programs | 2 | * Input/Output interface for Lua programs |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: buffer.c,v 1.29 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include "lua.h" | 5 | #include "lua.h" |
8 | #include "lauxlib.h" | 6 | #include "lauxlib.h" |
diff --git a/src/except.c b/src/except.c index 97c00a3..1d1ade0 100644 --- a/src/except.c +++ b/src/except.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Simple exception support | 2 | * Simple exception support |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: except.c,v 1.8 2005/09/29 06:11:41 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <stdio.h> | 5 | #include <stdio.h> |
8 | 6 | ||
diff --git a/src/ftp.lua b/src/ftp.lua index 1d5ff77..5aa646b 100644 --- a/src/ftp.lua +++ b/src/ftp.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- FTP support for the Lua language | 2 | -- FTP support for the Lua language |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: ftp.lua,v 1.45 2007/07/11 19:25:47 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
diff --git a/src/headers.lua b/src/headers.lua index f92ee7a..41794ba 100644 --- a/src/headers.lua +++ b/src/headers.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- Canonic header field capitalization | 2 | -- Canonic header field capitalization |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id$ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | module("socket.headers") | 6 | module("socket.headers") |
8 | 7 | ||
diff --git a/src/http.lua b/src/http.lua index 029a367..4c7e7d8 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- HTTP/1.1 client support for the Lua language. | 2 | -- HTTP/1.1 client support for the Lua language. |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: http.lua,v 1.72 2009/05/27 09:31:35 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Internet domain functions | 2 | * Internet domain functions |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: inet.c,v 1.28 2005/10/07 04:40:59 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <stdio.h> | 5 | #include <stdio.h> |
8 | #include <string.h> | 6 | #include <string.h> |
@@ -270,8 +268,8 @@ static void inet_pushresolved(lua_State *L, struct hostent *hp) | |||
270 | /*-------------------------------------------------------------------------*\ | 268 | /*-------------------------------------------------------------------------*\ |
271 | * Tries to create a new inet socket | 269 | * Tries to create a new inet socket |
272 | \*-------------------------------------------------------------------------*/ | 270 | \*-------------------------------------------------------------------------*/ |
273 | const char *inet_trycreate(p_socket ps, int domain, int type) { | 271 | const char *inet_trycreate(p_socket ps, int family, int type) { |
274 | return socket_strerror(socket_create(ps, domain, type, 0)); | 272 | return socket_strerror(socket_create(ps, family, type, 0)); |
275 | } | 273 | } |
276 | 274 | ||
277 | /*-------------------------------------------------------------------------*\ | 275 | /*-------------------------------------------------------------------------*\ |
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Input/Output abstraction | 2 | * Input/Output abstraction |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: io.c,v 1.6 2005/09/29 06:11:41 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include "io.h" | 5 | #include "io.h" |
8 | 6 | ||
diff --git a/src/ltn12.lua b/src/ltn12.lua index b42689a..b7f9a21 100644 --- a/src/ltn12.lua +++ b/src/ltn12.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- LTN12 - Filters, sources, sinks and pumps. | 2 | -- LTN12 - Filters, sources, sinks and pumps. |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: ltn12.lua,v 1.31 2006/04/03 04:45:42 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
diff --git a/src/luasocket.h b/src/luasocket.h index 09e758d..f2ca3c1 100644 --- a/src/luasocket.h +++ b/src/luasocket.h | |||
@@ -11,7 +11,7 @@ | |||
11 | /*-------------------------------------------------------------------------*\ | 11 | /*-------------------------------------------------------------------------*\ |
12 | * Current socket library version | 12 | * Current socket library version |
13 | \*-------------------------------------------------------------------------*/ | 13 | \*-------------------------------------------------------------------------*/ |
14 | #define LUASOCKET_VERSION "LuaSocket 2.1.1-rc1" | 14 | #define LUASOCKET_VERSION "LuaSocket 2.1-rc1" |
15 | #define LUASOCKET_COPYRIGHT "Copyright (C) 1999-2012 Diego Nehab" | 15 | #define LUASOCKET_COPYRIGHT "Copyright (C) 1999-2012 Diego Nehab" |
16 | #define LUASOCKET_AUTHORS "Diego Nehab" | 16 | #define LUASOCKET_AUTHORS "Diego Nehab" |
17 | 17 | ||
diff --git a/src/makefile b/src/makefile index 0665c14..6225ce4 100644 --- a/src/makefile +++ b/src/makefile | |||
@@ -98,7 +98,7 @@ SOCKET_win32=wsocket.obj | |||
98 | # | 98 | # |
99 | SO=$(SO_$(PLAT)) | 99 | SO=$(SO_$(PLAT)) |
100 | O=$(O_$(PLAT)) | 100 | O=$(O_$(PLAT)) |
101 | SOCKET_V=2.1.1 | 101 | SOCKET_V=2.1 |
102 | MIME_V=1.0.3 | 102 | MIME_V=1.0.3 |
103 | SOCKET_SO=socket.$(SO).$(SOCKET_V) | 103 | SOCKET_SO=socket.$(SO).$(SOCKET_V) |
104 | MIME_SO=mime.$(SO).$(MIME_V) | 104 | MIME_SO=mime.$(SO).$(MIME_V) |
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * MIME support functions | 2 | * MIME support functions |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: mime.c,v 1.29 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | ||
diff --git a/src/mime.lua b/src/mime.lua index 218b38a..4aaccc8 100644 --- a/src/mime.lua +++ b/src/mime.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- MIME support for the Lua language. | 2 | -- MIME support for the Lua language. |
3 | -- Author: Diego Nehab | 3 | -- Author: Diego Nehab |
4 | -- Conforming to RFCs 2045-2049 | 4 | -- Conforming to RFCs 2045-2049 |
5 | -- RCS ID: $Id: mime.lua,v 1.29 2007/06/11 23:44:54 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
diff --git a/src/options.c b/src/options.c index c122ead..6cae7ee 100644 --- a/src/options.c +++ b/src/options.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Common option interface | 2 | * Common option interface |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: options.c,v 1.7 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | ||
diff --git a/src/select.c b/src/select.c index 87b5dc2..b870545 100644 --- a/src/select.c +++ b/src/select.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Select implementation | 2 | * Select implementation |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: select.c,v 1.23 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | ||
diff --git a/src/smtp.lua b/src/smtp.lua index e258d62..26808f5 100644 --- a/src/smtp.lua +++ b/src/smtp.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- SMTP client support for the Lua language. | 2 | -- SMTP client support for the Lua language. |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: smtp.lua,v 1.47 2009/05/27 09:31:35 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
diff --git a/src/socket.lua b/src/socket.lua index 734da3c..a9219b0 100644 --- a/src/socket.lua +++ b/src/socket.lua | |||
@@ -1,7 +1,6 @@ | |||
1 | ----------------------------------------------------------------------------- | 1 | ----------------------------------------------------------------------------- |
2 | -- LuaSocket helper module | 2 | -- LuaSocket helper module |
3 | -- Author: Diego Nehab | 3 | -- Author: Diego Nehab |
4 | -- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $ | ||
5 | ----------------------------------------------------------------------------- | 4 | ----------------------------------------------------------------------------- |
6 | 5 | ||
7 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * TCP object | 2 | * TCP object |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: tcp.c,v 1.42 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | ||
@@ -23,6 +21,7 @@ static int global_create6(lua_State *L); | |||
23 | static int global_connect6(lua_State *L); | 21 | static int global_connect6(lua_State *L); |
24 | static int meth_connect(lua_State *L); | 22 | static int meth_connect(lua_State *L); |
25 | static int meth_listen(lua_State *L); | 23 | static int meth_listen(lua_State *L); |
24 | static int meth_getfamily(lua_State *L); | ||
26 | static int meth_bind(lua_State *L); | 25 | static int meth_bind(lua_State *L); |
27 | static int meth_send(lua_State *L); | 26 | static int meth_send(lua_State *L); |
28 | static int meth_getstats(lua_State *L); | 27 | static int meth_getstats(lua_State *L); |
@@ -49,6 +48,7 @@ static luaL_Reg tcp_methods[] = { | |||
49 | {"close", meth_close}, | 48 | {"close", meth_close}, |
50 | {"connect", meth_connect}, | 49 | {"connect", meth_connect}, |
51 | {"dirty", meth_dirty}, | 50 | {"dirty", meth_dirty}, |
51 | {"getfamily", meth_getfamily}, | ||
52 | {"getfd", meth_getfd}, | 52 | {"getfd", meth_getfd}, |
53 | {"getoption", meth_getoption}, | 53 | {"getoption", meth_getoption}, |
54 | {"getpeername", meth_getpeername}, | 54 | {"getpeername", meth_getpeername}, |
@@ -218,7 +218,7 @@ static int meth_bind(lua_State *L) | |||
218 | struct addrinfo bindhints; | 218 | struct addrinfo bindhints; |
219 | memset(&bindhints, 0, sizeof(bindhints)); | 219 | memset(&bindhints, 0, sizeof(bindhints)); |
220 | bindhints.ai_socktype = SOCK_STREAM; | 220 | bindhints.ai_socktype = SOCK_STREAM; |
221 | bindhints.ai_family = tcp->domain; | 221 | bindhints.ai_family = tcp->family; |
222 | bindhints.ai_flags = AI_PASSIVE; | 222 | bindhints.ai_flags = AI_PASSIVE; |
223 | err = inet_trybind(&tcp->sock, address, port, &bindhints); | 223 | err = inet_trybind(&tcp->sock, address, port, &bindhints); |
224 | if (err) { | 224 | if (err) { |
@@ -243,7 +243,7 @@ static int meth_connect(lua_State *L) | |||
243 | memset(&connecthints, 0, sizeof(connecthints)); | 243 | memset(&connecthints, 0, sizeof(connecthints)); |
244 | connecthints.ai_socktype = SOCK_STREAM; | 244 | connecthints.ai_socktype = SOCK_STREAM; |
245 | /* make sure we try to connect only to the same family */ | 245 | /* make sure we try to connect only to the same family */ |
246 | connecthints.ai_family = tcp->domain; | 246 | connecthints.ai_family = tcp->family; |
247 | timeout_markstart(&tcp->tm); | 247 | timeout_markstart(&tcp->tm); |
248 | err = inet_tryconnect(&tcp->sock, address, port, | 248 | err = inet_tryconnect(&tcp->sock, address, port, |
249 | &tcp->tm, &connecthints); | 249 | &tcp->tm, &connecthints); |
@@ -270,6 +270,21 @@ static int meth_close(lua_State *L) | |||
270 | } | 270 | } |
271 | 271 | ||
272 | /*-------------------------------------------------------------------------*\ | 272 | /*-------------------------------------------------------------------------*\ |
273 | * Returns family as string | ||
274 | \*-------------------------------------------------------------------------*/ | ||
275 | static int meth_getfamily(lua_State *L) | ||
276 | { | ||
277 | p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); | ||
278 | if (tcp->family == PF_INET6) { | ||
279 | lua_pushliteral(L, "inet6"); | ||
280 | return 1; | ||
281 | } else { | ||
282 | lua_pushliteral(L, "inet4"); | ||
283 | return 1; | ||
284 | } | ||
285 | } | ||
286 | |||
287 | /*-------------------------------------------------------------------------*\ | ||
273 | * Puts the sockt in listen mode | 288 | * Puts the sockt in listen mode |
274 | \*-------------------------------------------------------------------------*/ | 289 | \*-------------------------------------------------------------------------*/ |
275 | static int meth_listen(lua_State *L) | 290 | static int meth_listen(lua_State *L) |
@@ -346,9 +361,9 @@ static int meth_settimeout(lua_State *L) | |||
346 | /*-------------------------------------------------------------------------*\ | 361 | /*-------------------------------------------------------------------------*\ |
347 | * Creates a master tcp object | 362 | * Creates a master tcp object |
348 | \*-------------------------------------------------------------------------*/ | 363 | \*-------------------------------------------------------------------------*/ |
349 | static int tcp_create(lua_State *L, int domain) { | 364 | static int tcp_create(lua_State *L, int family) { |
350 | t_socket sock; | 365 | t_socket sock; |
351 | const char *err = inet_trycreate(&sock, domain, SOCK_STREAM); | 366 | const char *err = inet_trycreate(&sock, family, SOCK_STREAM); |
352 | /* try to allocate a system socket */ | 367 | /* try to allocate a system socket */ |
353 | if (!err) { | 368 | if (!err) { |
354 | /* allocate tcp object */ | 369 | /* allocate tcp object */ |
@@ -357,7 +372,7 @@ static int tcp_create(lua_State *L, int domain) { | |||
357 | auxiliar_setclass(L, "tcp{master}", -1); | 372 | auxiliar_setclass(L, "tcp{master}", -1); |
358 | /* initialize remaining structure fields */ | 373 | /* initialize remaining structure fields */ |
359 | socket_setnonblocking(&sock); | 374 | socket_setnonblocking(&sock); |
360 | if (domain == PF_INET6) { | 375 | if (family == PF_INET6) { |
361 | int yes = 1; | 376 | int yes = 1; |
362 | setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, | 377 | setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, |
363 | (void *)&yes, sizeof(yes)); | 378 | (void *)&yes, sizeof(yes)); |
@@ -367,7 +382,7 @@ static int tcp_create(lua_State *L, int domain) { | |||
367 | (p_error) socket_ioerror, &tcp->sock); | 382 | (p_error) socket_ioerror, &tcp->sock); |
368 | timeout_init(&tcp->tm, -1, -1); | 383 | timeout_init(&tcp->tm, -1, -1); |
369 | buffer_init(&tcp->buf, &tcp->io, &tcp->tm); | 384 | buffer_init(&tcp->buf, &tcp->io, &tcp->tm); |
370 | tcp->domain = domain; | 385 | tcp->family = family; |
371 | return 1; | 386 | return 1; |
372 | } else { | 387 | } else { |
373 | lua_pushnil(L); | 388 | lua_pushnil(L); |
@@ -25,7 +25,7 @@ typedef struct t_tcp_ { | |||
25 | t_io io; | 25 | t_io io; |
26 | t_buffer buf; | 26 | t_buffer buf; |
27 | t_timeout tm; | 27 | t_timeout tm; |
28 | int domain; | 28 | int family; |
29 | } t_tcp; | 29 | } t_tcp; |
30 | 30 | ||
31 | typedef t_tcp *p_tcp; | 31 | typedef t_tcp *p_tcp; |
diff --git a/src/timeout.c b/src/timeout.c index a3f1318..c7354b5 100644 --- a/src/timeout.c +++ b/src/timeout.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Timeout management functions | 2 | * Timeout management functions |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: timeout.c,v 1.31 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <stdio.h> | 5 | #include <stdio.h> |
8 | #include <limits.h> | 6 | #include <limits.h> |
@@ -2,7 +2,6 @@ | |||
2 | -- Unified SMTP/FTP subsystem | 2 | -- Unified SMTP/FTP subsystem |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: tp.lua,v 1.23 2009/05/27 09:31:35 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * UDP object | 2 | * UDP object |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: udp.c,v 1.30 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | ||
@@ -32,6 +30,7 @@ static int meth_send(lua_State *L); | |||
32 | static int meth_sendto(lua_State *L); | 30 | static int meth_sendto(lua_State *L); |
33 | static int meth_receive(lua_State *L); | 31 | static int meth_receive(lua_State *L); |
34 | static int meth_receivefrom(lua_State *L); | 32 | static int meth_receivefrom(lua_State *L); |
33 | static int meth_getfamily(lua_State *L); | ||
35 | static int meth_getsockname(lua_State *L); | 34 | static int meth_getsockname(lua_State *L); |
36 | static int meth_getpeername(lua_State *L); | 35 | static int meth_getpeername(lua_State *L); |
37 | static int meth_setsockname(lua_State *L); | 36 | static int meth_setsockname(lua_State *L); |
@@ -50,6 +49,7 @@ static luaL_Reg udp_methods[] = { | |||
50 | {"__tostring", auxiliar_tostring}, | 49 | {"__tostring", auxiliar_tostring}, |
51 | {"close", meth_close}, | 50 | {"close", meth_close}, |
52 | {"dirty", meth_dirty}, | 51 | {"dirty", meth_dirty}, |
52 | {"getfamily", meth_getfamily}, | ||
53 | {"getfd", meth_getfd}, | 53 | {"getfd", meth_getfd}, |
54 | {"getpeername", meth_getpeername}, | 54 | {"getpeername", meth_getpeername}, |
55 | {"getsockname", meth_getsockname}, | 55 | {"getsockname", meth_getsockname}, |
@@ -227,6 +227,21 @@ static int meth_receivefrom(lua_State *L) { | |||
227 | } | 227 | } |
228 | 228 | ||
229 | /*-------------------------------------------------------------------------*\ | 229 | /*-------------------------------------------------------------------------*\ |
230 | * Returns family as string | ||
231 | \*-------------------------------------------------------------------------*/ | ||
232 | static int meth_getfamily(lua_State *L) | ||
233 | { | ||
234 | p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); | ||
235 | if (udp->family == PF_INET6) { | ||
236 | lua_pushliteral(L, "inet6"); | ||
237 | return 1; | ||
238 | } else { | ||
239 | lua_pushliteral(L, "inet4"); | ||
240 | return 1; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | /*-------------------------------------------------------------------------*\ | ||
230 | * Select support methods | 245 | * Select support methods |
231 | \*-------------------------------------------------------------------------*/ | 246 | \*-------------------------------------------------------------------------*/ |
232 | static int meth_getfd(lua_State *L) { | 247 | static int meth_getfd(lua_State *L) { |
@@ -302,7 +317,7 @@ static int meth_setpeername(lua_State *L) { | |||
302 | memset(&connecthints, 0, sizeof(connecthints)); | 317 | memset(&connecthints, 0, sizeof(connecthints)); |
303 | connecthints.ai_socktype = SOCK_DGRAM; | 318 | connecthints.ai_socktype = SOCK_DGRAM; |
304 | /* make sure we try to connect only to the same family */ | 319 | /* make sure we try to connect only to the same family */ |
305 | connecthints.ai_family = udp->domain; | 320 | connecthints.ai_family = udp->family; |
306 | err = inet_tryconnect(&udp->sock, address, port, | 321 | err = inet_tryconnect(&udp->sock, address, port, |
307 | tm, &connecthints); | 322 | tm, &connecthints); |
308 | if (err) { | 323 | if (err) { |
@@ -338,7 +353,7 @@ static int meth_setsockname(lua_State *L) { | |||
338 | struct addrinfo bindhints; | 353 | struct addrinfo bindhints; |
339 | memset(&bindhints, 0, sizeof(bindhints)); | 354 | memset(&bindhints, 0, sizeof(bindhints)); |
340 | bindhints.ai_socktype = SOCK_DGRAM; | 355 | bindhints.ai_socktype = SOCK_DGRAM; |
341 | bindhints.ai_family = udp->domain; | 356 | bindhints.ai_family = udp->family; |
342 | bindhints.ai_flags = AI_PASSIVE; | 357 | bindhints.ai_flags = AI_PASSIVE; |
343 | err = inet_trybind(&udp->sock, address, port, &bindhints); | 358 | err = inet_trybind(&udp->sock, address, port, &bindhints); |
344 | if (err) { | 359 | if (err) { |
@@ -356,9 +371,9 @@ static int meth_setsockname(lua_State *L) { | |||
356 | /*-------------------------------------------------------------------------*\ | 371 | /*-------------------------------------------------------------------------*\ |
357 | * Creates a master udp object | 372 | * Creates a master udp object |
358 | \*-------------------------------------------------------------------------*/ | 373 | \*-------------------------------------------------------------------------*/ |
359 | static int udp_create(lua_State *L, int domain) { | 374 | static int udp_create(lua_State *L, int family) { |
360 | t_socket sock; | 375 | t_socket sock; |
361 | const char *err = inet_trycreate(&sock, domain, SOCK_DGRAM); | 376 | const char *err = inet_trycreate(&sock, family, SOCK_DGRAM); |
362 | /* try to allocate a system socket */ | 377 | /* try to allocate a system socket */ |
363 | if (!err) { | 378 | if (!err) { |
364 | /* allocate udp object */ | 379 | /* allocate udp object */ |
@@ -366,14 +381,14 @@ static int udp_create(lua_State *L, int domain) { | |||
366 | auxiliar_setclass(L, "udp{unconnected}", -1); | 381 | auxiliar_setclass(L, "udp{unconnected}", -1); |
367 | /* initialize remaining structure fields */ | 382 | /* initialize remaining structure fields */ |
368 | socket_setnonblocking(&sock); | 383 | socket_setnonblocking(&sock); |
369 | if (domain == PF_INET6) { | 384 | if (family == PF_INET6) { |
370 | int yes = 1; | 385 | int yes = 1; |
371 | setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, | 386 | setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, |
372 | (void *)&yes, sizeof(yes)); | 387 | (void *)&yes, sizeof(yes)); |
373 | } | 388 | } |
374 | udp->sock = sock; | 389 | udp->sock = sock; |
375 | timeout_init(&udp->tm, -1, -1); | 390 | timeout_init(&udp->tm, -1, -1); |
376 | udp->domain = domain; | 391 | udp->family = family; |
377 | return 1; | 392 | return 1; |
378 | } else { | 393 | } else { |
379 | lua_pushnil(L); | 394 | lua_pushnil(L); |
@@ -23,7 +23,7 @@ | |||
23 | typedef struct t_udp_ { | 23 | typedef struct t_udp_ { |
24 | t_socket sock; | 24 | t_socket sock; |
25 | t_timeout tm; | 25 | t_timeout tm; |
26 | int domain; | 26 | int family; |
27 | } t_udp; | 27 | } t_udp; |
28 | typedef t_udp *p_udp; | 28 | typedef t_udp *p_udp; |
29 | 29 | ||
@@ -1,8 +1,6 @@ | |||
1 | /*=========================================================================*\ | 1 | /*=========================================================================*\ |
2 | * Unix domain socket | 2 | * Unix domain socket |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | * | ||
5 | * RCS ID: $Id: unix.c,v 1.14 2009/05/27 09:31:35 diego Exp $ | ||
6 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
7 | #include <string.h> | 5 | #include <string.h> |
8 | 6 | ||
diff --git a/src/url.lua b/src/url.lua index 1e59771..1bfecad 100644 --- a/src/url.lua +++ b/src/url.lua | |||
@@ -2,7 +2,6 @@ | |||
2 | -- URI parsing, composition and relative URL resolution | 2 | -- URI parsing, composition and relative URL resolution |
3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
5 | -- RCS ID: $Id: url.lua,v 1.38 2006/04/03 04:45:42 diego Exp $ | ||
6 | ----------------------------------------------------------------------------- | 5 | ----------------------------------------------------------------------------- |
7 | 6 | ||
8 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
@@ -16,7 +15,7 @@ module("socket.url") | |||
16 | ----------------------------------------------------------------------------- | 15 | ----------------------------------------------------------------------------- |
17 | -- Module version | 16 | -- Module version |
18 | ----------------------------------------------------------------------------- | 17 | ----------------------------------------------------------------------------- |
19 | _VERSION = "URL 1.0.1" | 18 | _VERSION = "URL 1.0.2" |
20 | 19 | ||
21 | ----------------------------------------------------------------------------- | 20 | ----------------------------------------------------------------------------- |
22 | -- Encodes a string into its escaped hexadecimal representation | 21 | -- Encodes a string into its escaped hexadecimal representation |
@@ -142,7 +141,7 @@ function parse(url, default) | |||
142 | parsed.authority = n | 141 | parsed.authority = n |
143 | return "" | 142 | return "" |
144 | end) | 143 | end) |
145 | -- get query stringing | 144 | -- get query string |
146 | url = string.gsub(url, "%?(.*)", function(q) | 145 | url = string.gsub(url, "%?(.*)", function(q) |
147 | parsed.query = q | 146 | parsed.query = q |
148 | return "" | 147 | return "" |
@@ -158,9 +157,12 @@ function parse(url, default) | |||
158 | if not authority then return parsed end | 157 | if not authority then return parsed end |
159 | authority = string.gsub(authority,"^([^@]*)@", | 158 | authority = string.gsub(authority,"^([^@]*)@", |
160 | function(u) parsed.userinfo = u; return "" end) | 159 | function(u) parsed.userinfo = u; return "" end) |
161 | authority = string.gsub(authority, ":([^:]*)$", | 160 | authority = string.gsub(authority, ":([^:%]]*)$", |
162 | function(p) parsed.port = p; return "" end) | 161 | function(p) parsed.port = p; return "" end) |
163 | if authority ~= "" then parsed.host = authority end | 162 | if authority ~= "" then |
163 | -- IPv6? | ||
164 | parsed.host = string.match(authority, "^%[(.+)%]$") or authority | ||
165 | end | ||
164 | local userinfo = parsed.userinfo | 166 | local userinfo = parsed.userinfo |
165 | if not userinfo then return parsed end | 167 | if not userinfo then return parsed end |
166 | userinfo = string.gsub(userinfo, ":([^:]*)$", | 168 | userinfo = string.gsub(userinfo, ":([^:]*)$", |
@@ -185,6 +187,9 @@ function build(parsed) | |||
185 | local authority = parsed.authority | 187 | local authority = parsed.authority |
186 | if parsed.host then | 188 | if parsed.host then |
187 | authority = parsed.host | 189 | authority = parsed.host |
190 | if string.find(authority, ":") then -- IPv6? | ||
191 | authority = "[" .. authority .. "]" | ||
192 | end | ||
188 | if parsed.port then authority = authority .. ":" .. parsed.port end | 193 | if parsed.port then authority = authority .. ":" .. parsed.port end |
189 | local userinfo = parsed.userinfo | 194 | local userinfo = parsed.userinfo |
190 | if parsed.user then | 195 | if parsed.user then |
diff --git a/src/usocket.c b/src/usocket.c index bf2d19c..80d4d70 100644 --- a/src/usocket.c +++ b/src/usocket.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * The code is now interrupt-safe. | 5 | * The code is now interrupt-safe. |
6 | * The penalty of calling select to avoid busy-wait is only paid when | 6 | * The penalty of calling select to avoid busy-wait is only paid when |
7 | * the I/O call fail in the first place. | 7 | * the I/O call fail in the first place. |
8 | * | ||
9 | * RCS ID: $Id: usocket.c,v 1.38 2007/10/13 23:55:20 diego Exp $ | ||
10 | \*=========================================================================*/ | 8 | \*=========================================================================*/ |
11 | #include <string.h> | 9 | #include <string.h> |
12 | #include <signal.h> | 10 | #include <signal.h> |
diff --git a/src/wsocket.c b/src/wsocket.c index c82882a..12e6352 100644 --- a/src/wsocket.c +++ b/src/wsocket.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * | 4 | * |
5 | * The penalty of calling select to avoid busy-wait is only paid when | 5 | * The penalty of calling select to avoid busy-wait is only paid when |
6 | * the I/O call fail in the first place. | 6 | * the I/O call fail in the first place. |
7 | * | ||
8 | * RCS ID: $Id: wsocket.c,v 1.36 2007/06/11 23:44:54 diego Exp $ | ||
9 | \*=========================================================================*/ | 7 | \*=========================================================================*/ |
10 | #include <string.h> | 8 | #include <string.h> |
11 | 9 | ||
diff --git a/test/urltest.lua b/test/urltest.lua index d46cb03..71e4428 100644 --- a/test/urltest.lua +++ b/test/urltest.lua | |||
@@ -8,7 +8,7 @@ local check_build_url = function(parsed) | |||
8 | print("built is different from expected") | 8 | print("built is different from expected") |
9 | print(built) | 9 | print(built) |
10 | print(expected) | 10 | print(expected) |
11 | exit() | 11 | os.exit() |
12 | end | 12 | end |
13 | end | 13 | end |
14 | 14 | ||
@@ -17,7 +17,7 @@ local check_protect = function(parsed, path, unsafe) | |||
17 | if built ~= path then | 17 | if built ~= path then |
18 | print(built, path) | 18 | print(built, path) |
19 | print("path composition failed.") | 19 | print("path composition failed.") |
20 | exit() | 20 | os.exit() |
21 | end | 21 | end |
22 | end | 22 | end |
23 | 23 | ||
@@ -28,7 +28,7 @@ local check_invert = function(url) | |||
28 | if rebuilt ~= url then | 28 | if rebuilt ~= url then |
29 | print(url, rebuilt) | 29 | print(url, rebuilt) |
30 | print("original and rebuilt are different") | 30 | print("original and rebuilt are different") |
31 | exit() | 31 | os.exit() |
32 | end | 32 | end |
33 | end | 33 | end |
34 | 34 | ||
@@ -37,24 +37,24 @@ local check_parse_path = function(path, expect) | |||
37 | for i = 1, math.max(table.getn(parsed), table.getn(expect)) do | 37 | for i = 1, math.max(table.getn(parsed), table.getn(expect)) do |
38 | if parsed[i] ~= expect[i] then | 38 | if parsed[i] ~= expect[i] then |
39 | print(path) | 39 | print(path) |
40 | exit() | 40 | os.exit() |
41 | end | 41 | end |
42 | end | 42 | end |
43 | if expect.is_directory ~= parsed.is_directory then | 43 | if expect.is_directory ~= parsed.is_directory then |
44 | print(path) | 44 | print(path) |
45 | print("is_directory mismatch") | 45 | print("is_directory mismatch") |
46 | exit() | 46 | os.exit() |
47 | end | 47 | end |
48 | if expect.is_absolute ~= parsed.is_absolute then | 48 | if expect.is_absolute ~= parsed.is_absolute then |
49 | print(path) | 49 | print(path) |
50 | print("is_absolute mismatch") | 50 | print("is_absolute mismatch") |
51 | exit() | 51 | os.exit() |
52 | end | 52 | end |
53 | local built = socket.url.build_path(expect) | 53 | local built = socket.url.build_path(expect) |
54 | if built ~= path then | 54 | if built ~= path then |
55 | print(built, path) | 55 | print(built, path) |
56 | print("path composition failed.") | 56 | print("path composition failed.") |
57 | exit() | 57 | os.exit() |
58 | end | 58 | end |
59 | end | 59 | end |
60 | 60 | ||
@@ -63,7 +63,7 @@ local check_absolute_url = function(base, relative, absolute) | |||
63 | if res ~= absolute then | 63 | if res ~= absolute then |
64 | io.write("absolute: In test for '", relative, "' expected '", | 64 | io.write("absolute: In test for '", relative, "' expected '", |
65 | absolute, "' but got '", res, "'\n") | 65 | absolute, "' but got '", res, "'\n") |
66 | exit() | 66 | os.exit() |
67 | end | 67 | end |
68 | end | 68 | end |
69 | 69 | ||
@@ -76,7 +76,7 @@ local check_parse_url = function(gaba) | |||
76 | io.write("parse: In test for '", url, "' expected ", i, " = '", | 76 | io.write("parse: In test for '", url, "' expected ", i, " = '", |
77 | v, "' but got '", tostring(parsed[i]), "'\n") | 77 | v, "' but got '", tostring(parsed[i]), "'\n") |
78 | for i,v in pairs(parsed) do print(i,v) end | 78 | for i,v in pairs(parsed) do print(i,v) end |
79 | exit() | 79 | os.exit() |
80 | end | 80 | end |
81 | end | 81 | end |
82 | for i, v in pairs(parsed) do | 82 | for i, v in pairs(parsed) do |
@@ -84,7 +84,7 @@ local check_parse_url = function(gaba) | |||
84 | io.write("parse: In test for '", url, "' expected ", i, " = '", | 84 | io.write("parse: In test for '", url, "' expected ", i, " = '", |
85 | tostring(gaba[i]), "' but got '", v, "'\n") | 85 | tostring(gaba[i]), "' but got '", v, "'\n") |
86 | for i,v in pairs(parsed) do print(i,v) end | 86 | for i,v in pairs(parsed) do print(i,v) end |
87 | exit() | 87 | os.exit() |
88 | end | 88 | end |
89 | end | 89 | end |
90 | end | 90 | end |
@@ -304,6 +304,92 @@ check_parse_url{ | |||
304 | path = "path", | 304 | path = "path", |
305 | } | 305 | } |
306 | 306 | ||
307 | -- IPv6 tests | ||
308 | |||
309 | check_parse_url{ | ||
310 | url = "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", | ||
311 | scheme = "http", | ||
312 | host = "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", | ||
313 | authority = "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80", | ||
314 | port = "80", | ||
315 | path = "/index.html" | ||
316 | } | ||
317 | |||
318 | check_parse_url{ | ||
319 | url = "http://[1080:0:0:0:8:800:200C:417A]/index.html", | ||
320 | scheme = "http", | ||
321 | host = "1080:0:0:0:8:800:200C:417A", | ||
322 | authority = "[1080:0:0:0:8:800:200C:417A]", | ||
323 | path = "/index.html" | ||
324 | } | ||
325 | |||
326 | check_parse_url{ | ||
327 | url = "http://[3ffe:2a00:100:7031::1]", | ||
328 | scheme = "http", | ||
329 | host = "3ffe:2a00:100:7031::1", | ||
330 | authority = "[3ffe:2a00:100:7031::1]", | ||
331 | } | ||
332 | |||
333 | check_parse_url{ | ||
334 | url = "http://[1080::8:800:200C:417A]/foo", | ||
335 | scheme = "http", | ||
336 | host = "1080::8:800:200C:417A", | ||
337 | authority = "[1080::8:800:200C:417A]", | ||
338 | path = "/foo" | ||
339 | } | ||
340 | |||
341 | check_parse_url{ | ||
342 | url = "http://[::192.9.5.5]/ipng", | ||
343 | scheme = "http", | ||
344 | host = "::192.9.5.5", | ||
345 | authority = "[::192.9.5.5]", | ||
346 | path = "/ipng" | ||
347 | } | ||
348 | |||
349 | check_parse_url{ | ||
350 | url = "http://[::FFFF:129.144.52.38]:80/index.html", | ||
351 | scheme = "http", | ||
352 | host = "::FFFF:129.144.52.38", | ||
353 | port = "80", | ||
354 | authority = "[::FFFF:129.144.52.38]:80", | ||
355 | path = "/index.html" | ||
356 | } | ||
357 | |||
358 | check_parse_url{ | ||
359 | url = "http://[2010:836B:4179::836B:4179]", | ||
360 | scheme = "http", | ||
361 | host = "2010:836B:4179::836B:4179", | ||
362 | authority = "[2010:836B:4179::836B:4179]", | ||
363 | } | ||
364 | |||
365 | check_parse_url{ | ||
366 | url = "//userinfo@[::FFFF:129.144.52.38]:port/path;params?query#fragment", | ||
367 | authority = "userinfo@[::FFFF:129.144.52.38]:port", | ||
368 | host = "::FFFF:129.144.52.38", | ||
369 | port = "port", | ||
370 | userinfo = "userinfo", | ||
371 | user = "userinfo", | ||
372 | path = "/path", | ||
373 | params = "params", | ||
374 | query = "query", | ||
375 | fragment = "fragment" | ||
376 | } | ||
377 | |||
378 | check_parse_url{ | ||
379 | url = "scheme://user:password@[::192.9.5.5]:port/path;params?query#fragment", | ||
380 | scheme = "scheme", | ||
381 | authority = "user:password@[::192.9.5.5]:port", | ||
382 | host = "::192.9.5.5", | ||
383 | port = "port", | ||
384 | userinfo = "user:password", | ||
385 | user = "user", | ||
386 | password = "password", | ||
387 | path = "/path", | ||
388 | params = "params", | ||
389 | query = "query", | ||
390 | fragment = "fragment" | ||
391 | } | ||
392 | |||
307 | print("testing URL building") | 393 | print("testing URL building") |
308 | check_build_url { | 394 | check_build_url { |
309 | url = "scheme://user:password@host:port/path;params?query#fragment", | 395 | url = "scheme://user:password@host:port/path;params?query#fragment", |
@@ -318,6 +404,30 @@ check_build_url { | |||
318 | fragment = "fragment" | 404 | fragment = "fragment" |
319 | } | 405 | } |
320 | 406 | ||
407 | check_build_url{ | ||
408 | url = "//userinfo@[::FFFF:129.144.52.38]:port/path;params?query#fragment", | ||
409 | host = "::FFFF:129.144.52.38", | ||
410 | port = "port", | ||
411 | user = "userinfo", | ||
412 | path = "/path", | ||
413 | params = "params", | ||
414 | query = "query", | ||
415 | fragment = "fragment" | ||
416 | } | ||
417 | |||
418 | check_build_url{ | ||
419 | url = "scheme://user:password@[::192.9.5.5]:port/path;params?query#fragment", | ||
420 | scheme = "scheme", | ||
421 | host = "::192.9.5.5", | ||
422 | port = "port", | ||
423 | user = "user", | ||
424 | password = "password", | ||
425 | path = "/path", | ||
426 | params = "params", | ||
427 | query = "query", | ||
428 | fragment = "fragment" | ||
429 | } | ||
430 | |||
321 | check_build_url { | 431 | check_build_url { |
322 | url = "scheme://user:password@host/path;params?query#fragment", | 432 | url = "scheme://user:password@host/path;params?query#fragment", |
323 | scheme = "scheme", | 433 | scheme = "scheme", |
@@ -520,5 +630,6 @@ check_invert("/b/c/d;param#fragment") | |||
520 | check_invert("/b/c/d;param?query#fragment") | 630 | check_invert("/b/c/d;param?query#fragment") |
521 | check_invert("/b/c/d?query") | 631 | check_invert("/b/c/d?query") |
522 | check_invert("/b/c/d;param?query") | 632 | check_invert("/b/c/d;param?query") |
633 | check_invert("http://he:man@[::192.168.1.1]/a/b/c/i.html;type=moo?this=that#mark") | ||
523 | 634 | ||
524 | print("the library passed all tests") | 635 | print("the library passed all tests") |