diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-06-14 04:29:23 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2005-06-14 04:29:23 +0000 |
commit | 65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3 (patch) | |
tree | f6e3f1a31451281ac2a347c3080e9749456dac29 | |
parent | 8b114f3bf4ccea3b065551fa94649a9e45935b5b (diff) | |
download | luasocket-65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3.tar.gz luasocket-65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3.tar.bz2 luasocket-65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3.zip |
Working on the manual.
-rw-r--r-- | FIX | 15 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | doc/index.html | 94 | ||||
-rw-r--r-- | doc/reference.html | 4 | ||||
-rw-r--r-- | doc/socket.html | 8 | ||||
-rw-r--r-- | etc/dict.lua | 2 | ||||
-rw-r--r-- | etc/lp.lua | 2 | ||||
-rw-r--r-- | etc/tftp.lua | 2 | ||||
-rw-r--r-- | src/ftp.lua | 2 | ||||
-rw-r--r-- | src/http.lua | 4 | ||||
-rw-r--r-- | src/inet.c | 24 | ||||
-rw-r--r-- | src/ltn12.lua | 2 | ||||
-rw-r--r-- | src/luasocket.c | 4 | ||||
-rw-r--r-- | src/mime.lua | 3 | ||||
-rw-r--r-- | src/smtp.lua | 4 | ||||
-rw-r--r-- | src/socket.lua | 3 | ||||
-rw-r--r-- | src/tp.lua | 2 | ||||
-rw-r--r-- | src/url.lua | 2 | ||||
-rw-r--r-- | test/testclnt.lua | 2 |
19 files changed, 91 insertions, 91 deletions
@@ -1,13 +1,16 @@ | |||
1 | url.absolute was not working when base_url was already parsed | 1 | url.absolute was not working when base_url was already parsed |
2 | http.request was redirecting even when the location header is empty | 2 | http.request was redirecting even when the location header was empty |
3 | tcp{client}:shutdown() was checking for group instead of class. | 3 | tcp{client}:shutdown() was checking for group instead of class. |
4 | tcp{client}:send() now returns i+sent-1... | 4 | tcp{client}:send() now returns i+sent-1... |
5 | get rid of a = socket.try() in the manual, except for protected cases. | 5 | get rid of a = socket.try() in the manual, except for protected cases. replace it with assert. |
6 | replace it with assert. | 6 | get rid of "base." kludge in package.loaded |
7 | get rid of "base." kludge | ||
8 | check all "require("http")" etc in the manual. | 7 | check all "require("http")" etc in the manual. |
9 | make sure sock_gethostname.* only return success if the hp is not null! | 8 | make sure sock_gethostname.* only return success if the hp is not null! |
10 | change 'l' prefix in C libraries to 'c' | 9 | change 'l' prefix in C libraries to 'c' to avoid clash with LHF libraries |
11 | don't forget the declarations in luasocket.h and mime.h!!! | 10 | don't forget the declarations in luasocket.h and mime.h!!! |
12 | setpeername was using udp{unconnected} | 11 | setpeername was using udp{unconnected} |
13 | fixed a bug in http.lua that caused some requests to fail | 12 | fixed a bug in http.lua that caused some requests to fail (Florian Berger) |
13 | fixed a bug in select.c that prevented sockets with descriptor 0 from working (Renato Maia) | ||
14 | fixed a "bug" that caused dns.toip to crash under uLinux | ||
15 | fixed a "bug" that caused a crash in gethostbyname under VMS | ||
16 | DEBUG and VERSION became _DEBUG and _VERSION | ||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | talk about the non-blocking connect in the manual | 1 | talk about the non-blocking connect in the manual |
3 | test it on Windows!!! | 2 | test it on Windows!!! |
4 | 3 | ||
@@ -13,7 +12,6 @@ functions for non-blocking so they can be used in the context of the | |||
13 | dispatcher! | 12 | dispatcher! |
14 | 13 | ||
15 | adjust manual for new sock:send returns. | 14 | adjust manual for new sock:send returns. |
16 | _VERSION, _DEBUG, etc. | ||
17 | 15 | ||
18 | leave code for losers that don't have nanosleep | 16 | leave code for losers that don't have nanosleep |
19 | 17 | ||
@@ -42,3 +40,4 @@ testar os options! | |||
42 | eliminate globals from namespaces created by module(). | 40 | eliminate globals from namespaces created by module(). |
43 | 41 | ||
44 | * BUG NO SET DO TINYIRC!!! SINISTRO. | 42 | * BUG NO SET DO TINYIRC!!! SINISTRO. |
43 | * _VERSION, _DEBUG, etc. | ||
diff --git a/doc/index.html b/doc/index.html index cfd3548..ee97e02 100644 --- a/doc/index.html +++ b/doc/index.html | |||
@@ -93,38 +93,24 @@ Windows XP, Linux, and Mac OS X. | |||
93 | </p> | 93 | </p> |
94 | 94 | ||
95 | <p> | 95 | <p> |
96 | The library can be downloaded in source code from the following links: | 96 | The library can be downloaded in source code from the |
97 | </p> | 97 | <a href=http://luaforge.net/projects/luasocket/>LuaSocket |
98 | 98 | project page</a> at LuaForge. | |
99 | <blockquote> | ||
100 | <p> | ||
101 | <a href="luasocket-2.0.tar.gz">luasocket-2.0.tar.gz</a> <br> | ||
102 | <a href="luasocket-2.0.zip">luasocket-2.0.zip</a> | ||
103 | </p> | ||
104 | </blockquote> | ||
105 | |||
106 | <p> | ||
107 | Besides the full C and Lua source code for the library, the distribution | 99 | Besides the full C and Lua source code for the library, the distribution |
108 | contains several examples, this user's manual and basic test procedures. | 100 | contains several examples, this user's manual and basic test procedures. |
109 | </p> | 101 | </p> |
110 | 102 | ||
111 | <p> | 103 | <p> |
112 | I am also providing PC Win32 binaries for those that want to give | 104 | Danilo Tuler is mantaining Win32 binaries for LuaSocket, which are also |
113 | LuaSocket a try (those on Unix or Mac OS X can just type <tt>make</tt>). | 105 | available from LuaForge. These are compatible with the |
114 | These are compatible with the | ||
115 | <a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a> | 106 | <a href=http://luaforge.net/projects/luabinaries>LuaBinaries</a> |
116 | available from LuaForge. | 107 | available from LuaForge. |
117 | </p> | 108 | </p> |
118 | 109 | ||
119 | <blockquote> | ||
120 | <p> | 110 | <p> |
121 | <a href="luasocket-2.0-win32.zip">luasocket-2.0-win32.zip</a> | 111 | For those that want to give LuaSocket a quick try, download the |
122 | </p> | 112 | stand-alone archive and unpack everything into |
123 | </blockquote> | 113 | a directory, say <tt>c:\luasocket</tt>. Then set <tt>LUA_INIT</tt> to load |
124 | |||
125 | <p> | ||
126 | The quick and dirty way to use these binaries is to unpack everything into | ||
127 | a directory, say <tt>c:\luasocket</tt>, then set <tt>LUA_INIT</tt> to load | ||
128 | the <tt>compat-5.1.lua</tt> and set <tt>LUA_PATH</tt> and | 114 | the <tt>compat-5.1.lua</tt> and set <tt>LUA_PATH</tt> and |
129 | <tt>LUA_CPATH</tt> to look for files in the current directory: | 115 | <tt>LUA_CPATH</tt> to look for files in the current directory: |
130 | </p> | 116 | </p> |
@@ -142,10 +128,10 @@ do the following: | |||
142 | </p> | 128 | </p> |
143 | 129 | ||
144 | <pre class=example> | 130 | <pre class=example> |
145 | c:\luasocket\> lua | 131 | c:\luasocket\> lua50 |
146 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio | 132 | Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio |
147 | > http = require"socket.http" | 133 | > http = require"socket.http" |
148 | > print(http.request"http://www.tecgraf.puc-rio.br/luasocket/") | 134 | > print(http.request"http://www.cs.princeton.edu/~diego/professional/luasocket/") |
149 | --> the source to this web page gets dumped to terminal | 135 | --> the source to this web page gets dumped to terminal |
150 | </pre> | 136 | </pre> |
151 | 137 | ||
@@ -173,31 +159,39 @@ has been helping a lot too! Thanks to you all! | |||
173 | <h2 id=new>What's New</h2> | 159 | <h2 id=new>What's New</h2> |
174 | 160 | ||
175 | <p> | 161 | <p> |
176 | The big change for the 2.0 (beta3) release was the adoption of the Lua 5.1 | 162 | There is no big change for the 2.0 (final) release. It is basically a |
177 | package proposal. Naturally, there were a few bug fixes (a beta is a | 163 | bug fix release. The only improvement is in the non-blocking |
178 | beta, is a beta). | 164 | support. |
179 | </p> | 165 | </p> |
180 | 166 | ||
181 | <ul> | 167 | <ul> |
182 | <li> New compat-5.1 distribution: | 168 | <li> Improved: <tt>tcp{client}:send(data, i)</tt> now returns <tt>(i+sent-1)</tt>. This is great for non-blocking I/O, but might break some code; |
183 | <ul> | 169 | <li> Improved: HTTP, SMTP, and FTP functions accept a new field |
184 | <li> Installation uses new directory structure; | 170 | <tt>connect</tt> that can be used to replace the function invoked to |
185 | <li> Namespace hierarchy is in now back in use (ex. <tt>socket.url</tt> | 171 | create and connect the sockets used internally; |
186 | instead of <tt>url</tt>); | 172 | <li> Fixed: <tt>url.absolute()</tt> was not working when <tt>base_url</tt> was |
187 | <li> All modules call <tt>require</tt> even for standard libraries; | 173 | already parsed; |
188 | </ul> | 174 | <li> Fixed: <tt>http.request()</tt> was redirecting even when the location |
189 | <li> <tt>socket.select</tt> wasn't calling <tt>tm_markstart</tt>; | 175 | header was empty (well, it shouldn't be empty); |
190 | <li> LTN12 avoids coroutines (so you can go wild on the C side); | 176 | <li> Fixed: <tt>tcp{client}:shutdown()</tt> was checking for group instead of class; |
191 | <li> Kludge on wsocket.c:sock_send for windows timeout issue | 177 | <li> Fixed: <tt>socket.try()</tt> can't be used in place of <tt>assert()</tt>. The manual and examples don't do it anymore; |
192 | moved to buffer.c:sendraw so it's not a kludge anymore; | 178 | <li> Improved: Get rid of <tt>require("base")</tt> kludge in <tt>package.loaded</tt>; |
193 | <li> <tt>socket.protect </tt>only catches errors thrown by <tt>socket.try</tt>; | 179 | <li> Fixedd: Parts of the manual referred to <tt>require("http")</tt> instead of |
194 | <li> Fixed <tt>udp:sendto</tt> to call <tt>sock_sendto</tt> instead of | 180 | <tt>require("socket.http")</tt>; |
195 | <tt>sock_send</tt>; | 181 | <li> Improved: Changed 'l' prefix in C libraries to 'c' to avoid clash with LHF |
196 | <li> <tt>close</tt> wasn't returning 1! | 182 | libraries; |
197 | <li> <tt>socket.gettime</tt> returns time since Unix Epoch 1/1/1970 (UTC); | 183 | <li> Improved: Using bundles in Mac OS X; |
198 | <li> <tt>socket.sleep</tt> is robust to interrupts; | 184 | <li> Fixed: <tt>luasocket.h</tt> was exporting <tt>luaopen_socket</tt> |
199 | <li> <tt>http.PROXY</tt> wasn't working; | 185 | instead of <tt>luaopen_csocket</tt>; |
200 | <li> <tt>url.escape</tt> escapes only dangerous characters. | 186 | <li> Fixed: <tt>udp:setpeername()</tt> only worked for |
187 | <tt>udp{unconnected}</tt>. Now you can "disconnect" an <tt>UDP</tt> socket; | ||
188 | <li> Fixed: bug in http.lua that caused some requests to fail (Florian | ||
189 | Berger); | ||
190 | <li> Fixed: bug in <tt>select.c</tt> that prevented sockets with descriptor 0 from working (Renato Maia); | ||
191 | <li> Fixed: "bug" that caused <tt>dns.toip</tt> to crash under uLinux; | ||
192 | <li> Fixed: "bug" that caused a crash in <tt>gethostbyname</tt> under VMS | ||
193 | (Renato Maia); | ||
194 | <li> Improved: <tt>socket.DEBUG</tt> and <tt>socket.VERSION</tt> became <tt>socket._DEBUGs</tt> and <tt>socket._VERSION</tt> for uniformity with other libraries. | ||
201 | </ul> | 195 | </ul> |
202 | 196 | ||
203 | <!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 197 | <!-- incompatible +++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
@@ -205,9 +199,11 @@ beta, is a beta). | |||
205 | <h3 id=incompatible>Incompatibilities with previous versions</h3> | 199 | <h3 id=incompatible>Incompatibilities with previous versions</h3> |
206 | 200 | ||
207 | <ul> | 201 | <ul> |
208 | <li> Namespaces are hierarchical again. This means that whoever used to | 202 | <li> If you use the return value of <tt>tcp:send()</tt> <em>and</em> you |
209 | call <tt>require("url")</tt> should update their code to | 203 | use the extra parameters to select only part of the string to be sent, your |
210 | <tt>require("socket.url")</tt>. | 204 | code is now broken, but when you fix it, it will be much simpler; |
205 | <li> If you check <tt>socket.DEBUG</tt> or <tt>socket.VERSION</tt>, | ||
206 | change it to <tt>socket._DEBUG</tt> or <tt>socket._VERSION</tt>. | ||
211 | </ul> | 207 | </ul> |
212 | 208 | ||
213 | <!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 209 | <!-- old ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
diff --git a/doc/reference.html b/doc/reference.html index b2e31d5..fd5140b 100644 --- a/doc/reference.html +++ b/doc/reference.html | |||
@@ -142,7 +142,7 @@ Support, Manual"> | |||
142 | <blockquote> | 142 | <blockquote> |
143 | <a href="socket.html">Socket</a> | 143 | <a href="socket.html">Socket</a> |
144 | <blockquote> | 144 | <blockquote> |
145 | <a href="socket.html#debug">DEBUG</a>, | 145 | <a href="socket.html#_debug">_DEBUG</a>, |
146 | <a href="dns.html#dns">dns</a>, | 146 | <a href="dns.html#dns">dns</a>, |
147 | <a href="socket.html#gettime">gettime</a>, | 147 | <a href="socket.html#gettime">gettime</a>, |
148 | <a href="socket.html#newtry">newtry</a>, | 148 | <a href="socket.html#newtry">newtry</a>, |
@@ -155,7 +155,7 @@ Support, Manual"> | |||
155 | <a href="tcp.html#tcp">tcp</a>, | 155 | <a href="tcp.html#tcp">tcp</a>, |
156 | <a href="socket.html#try">try</a>, | 156 | <a href="socket.html#try">try</a>, |
157 | <a href="udp.html#udp">udp</a>, | 157 | <a href="udp.html#udp">udp</a>, |
158 | <a href="socket.html#version">VERSION</a>. | 158 | <a href="socket.html#_version">_VERSION</a>. |
159 | </blockquote> | 159 | </blockquote> |
160 | </blockquote> | 160 | </blockquote> |
161 | 161 | ||
diff --git a/doc/socket.html b/doc/socket.html index 18c71d1..5cc7157 100644 --- a/doc/socket.html +++ b/doc/socket.html | |||
@@ -85,8 +85,8 @@ the user can also specify the local address and port to bind | |||
85 | 85 | ||
86 | <!-- debug ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 86 | <!-- debug ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
87 | 87 | ||
88 | <p class=name id=debug> | 88 | <p class=name id=_debug> |
89 | socket.<b>DEBUG</b> | 89 | socket.<b>_DEBUG</b> |
90 | </p> | 90 | </p> |
91 | 91 | ||
92 | <p class=description> | 92 | <p class=description> |
@@ -372,8 +372,8 @@ c = socket.try(socket.connect("localhost", 80)) | |||
372 | 372 | ||
373 | <!-- version ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 373 | <!-- version ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
374 | 374 | ||
375 | <p class=name id=version> | 375 | <p class=name id=_version> |
376 | socket.<b>VERSION</b> | 376 | socket.<b>_VERSION</b> |
377 | </p> | 377 | </p> |
378 | 378 | ||
379 | <p class=description> | 379 | <p class=description> |
diff --git a/etc/dict.lua b/etc/dict.lua index a52b977..76b254a 100644 --- a/etc/dict.lua +++ b/etc/dict.lua | |||
@@ -8,7 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | -- Load required modules | 9 | -- Load required modules |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local base = require("base") | 11 | local base = _G |
12 | local string = require("string") | 12 | local string = require("string") |
13 | local table = require("table") | 13 | local table = require("table") |
14 | local socket = require("socket") | 14 | local socket = require("socket") |
@@ -10,7 +10,7 @@ | |||
10 | ]] | 10 | ]] |
11 | -- make sure LuaSocket is loaded | 11 | -- make sure LuaSocket is loaded |
12 | local io = require("io") | 12 | local io = require("io") |
13 | local base = require("base") | 13 | local base = _G |
14 | local string = require("string") | 14 | local string = require("string") |
15 | local socket = require("socket") | 15 | local socket = require("socket") |
16 | local ltn12 = require("ltn12") | 16 | local ltn12 = require("ltn12") |
diff --git a/etc/tftp.lua b/etc/tftp.lua index ba21a43..60658f7 100644 --- a/etc/tftp.lua +++ b/etc/tftp.lua | |||
@@ -8,7 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | -- Load required files | 9 | -- Load required files |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local base = require("base") | 11 | local base = _G |
12 | local table = require("table") | 12 | local table = require("table") |
13 | local math = require("math") | 13 | local math = require("math") |
14 | local string = require("string") | 14 | local string = require("string") |
diff --git a/src/ftp.lua b/src/ftp.lua index a793298..841df5f 100644 --- a/src/ftp.lua +++ b/src/ftp.lua | |||
@@ -8,7 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | -- Declare module and import dependencies | 9 | -- Declare module and import dependencies |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local base = require("base") | 11 | local base = _G |
12 | local table = require("table") | 12 | local table = require("table") |
13 | local string = require("string") | 13 | local string = require("string") |
14 | local math = require("math") | 14 | local math = require("math") |
diff --git a/src/http.lua b/src/http.lua index 669f54d..1a7b101 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -13,7 +13,7 @@ local url = require("socket.url") | |||
13 | local ltn12 = require("ltn12") | 13 | local ltn12 = require("ltn12") |
14 | local mime = require("mime") | 14 | local mime = require("mime") |
15 | local string = require("string") | 15 | local string = require("string") |
16 | local base = require("base") | 16 | local base = _G |
17 | local table = require("table") | 17 | local table = require("table") |
18 | module("socket.http") | 18 | module("socket.http") |
19 | 19 | ||
@@ -25,7 +25,7 @@ TIMEOUT = 60 | |||
25 | -- default port for document retrieval | 25 | -- default port for document retrieval |
26 | PORT = 80 | 26 | PORT = 80 |
27 | -- user agent field sent in request | 27 | -- user agent field sent in request |
28 | USERAGENT = socket.VERSION | 28 | USERAGENT = socket._VERSION |
29 | 29 | ||
30 | ----------------------------------------------------------------------------- | 30 | ----------------------------------------------------------------------------- |
31 | -- Extra sources and sinks | 31 | -- Extra sources and sinks |
@@ -172,21 +172,25 @@ static void inet_pushresolved(lua_State *L, struct hostent *hp) | |||
172 | i = 1; | 172 | i = 1; |
173 | alias = hp->h_aliases; | 173 | alias = hp->h_aliases; |
174 | lua_newtable(L); | 174 | lua_newtable(L); |
175 | while (*alias) { | 175 | if (alias) { |
176 | lua_pushnumber(L, i); | 176 | while (*alias) { |
177 | lua_pushstring(L, *alias); | 177 | lua_pushnumber(L, i); |
178 | lua_settable(L, -3); | 178 | lua_pushstring(L, *alias); |
179 | i++; alias++; | 179 | lua_settable(L, -3); |
180 | i++; alias++; | ||
181 | } | ||
180 | } | 182 | } |
181 | lua_settable(L, resolved); | 183 | lua_settable(L, resolved); |
182 | i = 1; | 184 | i = 1; |
183 | lua_newtable(L); | 185 | lua_newtable(L); |
184 | addr = (struct in_addr **) hp->h_addr_list; | 186 | addr = (struct in_addr **) hp->h_addr_list; |
185 | while (*addr) { | 187 | if (addr) { |
186 | lua_pushnumber(L, i); | 188 | while (*addr) { |
187 | lua_pushstring(L, inet_ntoa(**addr)); | 189 | lua_pushnumber(L, i); |
188 | lua_settable(L, -3); | 190 | lua_pushstring(L, inet_ntoa(**addr)); |
189 | i++; addr++; | 191 | lua_settable(L, -3); |
192 | i++; addr++; | ||
193 | } | ||
190 | } | 194 | } |
191 | lua_settable(L, resolved); | 195 | lua_settable(L, resolved); |
192 | } | 196 | } |
diff --git a/src/ltn12.lua b/src/ltn12.lua index 1acb9b1..fbc9dce 100644 --- a/src/ltn12.lua +++ b/src/ltn12.lua | |||
@@ -10,7 +10,7 @@ | |||
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local string = require("string") | 11 | local string = require("string") |
12 | local table = require("table") | 12 | local table = require("table") |
13 | local base = require("base") | 13 | local base = _G |
14 | module("ltn12") | 14 | module("ltn12") |
15 | 15 | ||
16 | filter = {} | 16 | filter = {} |
diff --git a/src/luasocket.c b/src/luasocket.c index 8f13dbc..2c3b526 100644 --- a/src/luasocket.c +++ b/src/luasocket.c | |||
@@ -89,12 +89,12 @@ static int base_open(lua_State *L) { | |||
89 | /* export functions (and leave namespace table on top of stack) */ | 89 | /* export functions (and leave namespace table on top of stack) */ |
90 | luaL_openlib(L, "socket", func, 0); | 90 | luaL_openlib(L, "socket", func, 0); |
91 | #ifdef LUASOCKET_DEBUG | 91 | #ifdef LUASOCKET_DEBUG |
92 | lua_pushstring(L, "DEBUG"); | 92 | lua_pushstring(L, "_DEBUG"); |
93 | lua_pushboolean(L, 1); | 93 | lua_pushboolean(L, 1); |
94 | lua_rawset(L, -3); | 94 | lua_rawset(L, -3); |
95 | #endif | 95 | #endif |
96 | /* make version string available to scripts */ | 96 | /* make version string available to scripts */ |
97 | lua_pushstring(L, "VERSION"); | 97 | lua_pushstring(L, "_VERSION"); |
98 | lua_pushstring(L, LUASOCKET_VERSION); | 98 | lua_pushstring(L, LUASOCKET_VERSION); |
99 | lua_rawset(L, -3); | 99 | lua_rawset(L, -3); |
100 | return 1; | 100 | return 1; |
diff --git a/src/mime.lua b/src/mime.lua index 6ef82b8..f6509a0 100644 --- a/src/mime.lua +++ b/src/mime.lua | |||
@@ -8,8 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | -- Declare module and import dependencies | 9 | -- Declare module and import dependencies |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | package.loaded.base = _G | 11 | local base = _G |
12 | local base = require("base") | ||
13 | local ltn12 = require("ltn12") | 12 | local ltn12 = require("ltn12") |
14 | local mime = require("cmime") | 13 | local mime = require("cmime") |
15 | module("mime") | 14 | module("mime") |
diff --git a/src/smtp.lua b/src/smtp.lua index 944a40f..6850f7f 100644 --- a/src/smtp.lua +++ b/src/smtp.lua | |||
@@ -8,7 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | -- Declare module and import dependencies | 9 | -- Declare module and import dependencies |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local base = require("base") | 11 | local base = _G |
12 | local coroutine = require("coroutine") | 12 | local coroutine = require("coroutine") |
13 | local string = require("string") | 13 | local string = require("string") |
14 | local math = require("math") | 14 | local math = require("math") |
@@ -216,7 +216,7 @@ local function adjust_headers(mesgt) | |||
216 | end | 216 | end |
217 | lower["date"] = lower["date"] or | 217 | lower["date"] = lower["date"] or |
218 | os.date("!%a, %d %b %Y %H:%M:%S ") .. (mesgt.zone or ZONE) | 218 | os.date("!%a, %d %b %Y %H:%M:%S ") .. (mesgt.zone or ZONE) |
219 | lower["x-mailer"] = lower["x-mailer"] or socket.VERSION | 219 | lower["x-mailer"] = lower["x-mailer"] or socket._VERSION |
220 | -- this can't be overriden | 220 | -- this can't be overriden |
221 | lower["mime-version"] = "1.0" | 221 | lower["mime-version"] = "1.0" |
222 | mesgt.headers = lower | 222 | mesgt.headers = lower |
diff --git a/src/socket.lua b/src/socket.lua index 9a523fe..d1c7846 100644 --- a/src/socket.lua +++ b/src/socket.lua | |||
@@ -7,8 +7,7 @@ | |||
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- Declare module and import dependencies | 8 | -- Declare module and import dependencies |
9 | ----------------------------------------------------------------------------- | 9 | ----------------------------------------------------------------------------- |
10 | package.loaded.base = _G | 10 | local base = _G |
11 | local base = require("base") | ||
12 | local string = require("string") | 11 | local string = require("string") |
13 | local math = require("math") | 12 | local math = require("math") |
14 | local socket = require("csocket") | 13 | local socket = require("csocket") |
@@ -8,7 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | -- Declare module and import dependencies | 9 | -- Declare module and import dependencies |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local base = require("base") | 11 | local base = _G |
12 | local string = require("string") | 12 | local string = require("string") |
13 | local socket = require("socket") | 13 | local socket = require("socket") |
14 | local ltn12 = require("ltn12") | 14 | local ltn12 = require("ltn12") |
diff --git a/src/url.lua b/src/url.lua index f29ecc8..0db111b 100644 --- a/src/url.lua +++ b/src/url.lua | |||
@@ -9,7 +9,7 @@ | |||
9 | -- Declare module | 9 | -- Declare module |
10 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local string = require("string") | 11 | local string = require("string") |
12 | local base = require("base") | 12 | local base = _G |
13 | local table = require("table") | 13 | local table = require("table") |
14 | module("socket.url") | 14 | module("socket.url") |
15 | 15 | ||
diff --git a/test/testclnt.lua b/test/testclnt.lua index e3f2b94..83f925b 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
@@ -69,7 +69,7 @@ function check_timeout(tm, sl, elapsed, err, opp, mode, alldone) | |||
69 | end | 69 | end |
70 | end | 70 | end |
71 | 71 | ||
72 | if not socket.DEBUG then | 72 | if not socket._DEBUG then |
73 | fail("Please define LUASOCKET_DEBUG and recompile LuaSocket") | 73 | fail("Please define LUASOCKET_DEBUG and recompile LuaSocket") |
74 | end | 74 | end |
75 | 75 | ||