Working on the manual.

This commit is contained in:
Diego Nehab
2005-06-14 04:29:23 +00:00
parent 8b114f3bf4
commit 65c35845c5
19 changed files with 91 additions and 91 deletions

View File

@ -8,7 +8,7 @@
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = require("base")
local base = _G
local table = require("table")
local string = require("string")
local math = require("math")

View File

@ -13,7 +13,7 @@ local url = require("socket.url")
local ltn12 = require("ltn12")
local mime = require("mime")
local string = require("string")
local base = require("base")
local base = _G
local table = require("table")
module("socket.http")
@ -25,7 +25,7 @@ TIMEOUT = 60
-- default port for document retrieval
PORT = 80
-- user agent field sent in request
USERAGENT = socket.VERSION
USERAGENT = socket._VERSION
-----------------------------------------------------------------------------
-- Extra sources and sinks

View File

@ -172,21 +172,25 @@ static void inet_pushresolved(lua_State *L, struct hostent *hp)
i = 1;
alias = hp->h_aliases;
lua_newtable(L);
while (*alias) {
lua_pushnumber(L, i);
lua_pushstring(L, *alias);
lua_settable(L, -3);
i++; alias++;
if (alias) {
while (*alias) {
lua_pushnumber(L, i);
lua_pushstring(L, *alias);
lua_settable(L, -3);
i++; alias++;
}
}
lua_settable(L, resolved);
i = 1;
lua_newtable(L);
addr = (struct in_addr **) hp->h_addr_list;
while (*addr) {
lua_pushnumber(L, i);
lua_pushstring(L, inet_ntoa(**addr));
lua_settable(L, -3);
i++; addr++;
if (addr) {
while (*addr) {
lua_pushnumber(L, i);
lua_pushstring(L, inet_ntoa(**addr));
lua_settable(L, -3);
i++; addr++;
}
}
lua_settable(L, resolved);
}

View File

@ -10,7 +10,7 @@
-----------------------------------------------------------------------------
local string = require("string")
local table = require("table")
local base = require("base")
local base = _G
module("ltn12")
filter = {}

View File

@ -89,12 +89,12 @@ static int base_open(lua_State *L) {
/* export functions (and leave namespace table on top of stack) */
luaL_openlib(L, "socket", func, 0);
#ifdef LUASOCKET_DEBUG
lua_pushstring(L, "DEBUG");
lua_pushstring(L, "_DEBUG");
lua_pushboolean(L, 1);
lua_rawset(L, -3);
#endif
/* make version string available to scripts */
lua_pushstring(L, "VERSION");
lua_pushstring(L, "_VERSION");
lua_pushstring(L, LUASOCKET_VERSION);
lua_rawset(L, -3);
return 1;

View File

@ -8,8 +8,7 @@
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
package.loaded.base = _G
local base = require("base")
local base = _G
local ltn12 = require("ltn12")
local mime = require("cmime")
module("mime")

View File

@ -8,7 +8,7 @@
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = require("base")
local base = _G
local coroutine = require("coroutine")
local string = require("string")
local math = require("math")
@ -216,7 +216,7 @@ local function adjust_headers(mesgt)
end
lower["date"] = lower["date"] or
os.date("!%a, %d %b %Y %H:%M:%S ") .. (mesgt.zone or ZONE)
lower["x-mailer"] = lower["x-mailer"] or socket.VERSION
lower["x-mailer"] = lower["x-mailer"] or socket._VERSION
-- this can't be overriden
lower["mime-version"] = "1.0"
mesgt.headers = lower

View File

@ -7,8 +7,7 @@
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
package.loaded.base = _G
local base = require("base")
local base = _G
local string = require("string")
local math = require("math")
local socket = require("csocket")

View File

@ -8,7 +8,7 @@
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = require("base")
local base = _G
local string = require("string")
local socket = require("socket")
local ltn12 = require("ltn12")

View File

@ -9,7 +9,7 @@
-- Declare module
-----------------------------------------------------------------------------
local string = require("string")
local base = require("base")
local base = _G
local table = require("table")
module("socket.url")