aboutsummaryrefslogtreecommitdiff
path: root/src/mime.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-15 06:24:00 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-15 06:24:00 +0000
commit58096449c6044b7aade5cd41cfd71c6bec1d273d (patch)
tree1814ffebe89c4c2556d84f97f66db37a7e8b4554 /src/mime.lua
parent9ed7f955e5fc69af9bf1794fa2c8cd227981ba24 (diff)
downloadluasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.tar.gz
luasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.tar.bz2
luasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.zip
Manual is almost done. HTTP is missing.
Implemented new distribution scheme. Select is now purely C. HTTP reimplemented seems faster dunno why. LTN12 functions that coroutines fail gracefully.
Diffstat (limited to 'src/mime.lua')
-rw-r--r--src/mime.lua14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/mime.lua b/src/mime.lua
index ecf310d..000404f 100644
--- a/src/mime.lua
+++ b/src/mime.lua
@@ -6,23 +6,15 @@
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7 7
8----------------------------------------------------------------------------- 8-----------------------------------------------------------------------------
9-- Load MIME from dynamic library
10-- Comment these lines if you are loading static
11-----------------------------------------------------------------------------
12local open = assert(loadlib("mime", "luaopen_mime"))
13local mime = assert(open())
14
15-----------------------------------------------------------------------------
16-- Load other required modules 9-- Load other required modules
17----------------------------------------------------------------------------- 10-----------------------------------------------------------------------------
11local mime = requirelib("mime", "luaopen_mime", getfenv(1))
18local ltn12 = require("ltn12") 12local ltn12 = require("ltn12")
19 13
20----------------------------------------------------------------------------- 14-----------------------------------------------------------------------------
21-- Setup namespace 15-- Setup namespace
22----------------------------------------------------------------------------- 16-----------------------------------------------------------------------------
23-- make all module globals fall into mime namespace 17_LOADED["mime"] = mime
24setmetatable(mime, { __index = _G })
25setfenv(1, mime)
26 18
27-- encode, decode and wrap algorithm tables 19-- encode, decode and wrap algorithm tables
28encodet = {} 20encodet = {}
@@ -48,7 +40,7 @@ end
48 40
49encodet['quoted-printable'] = function(mode) 41encodet['quoted-printable'] = function(mode)
50 return ltn12.filter.cycle(qp, "", 42 return ltn12.filter.cycle(qp, "",
51 (mode == "binary") and "=0D=0A" or "\13\10") 43 (mode == "binary") and "=0D=0A" or "\r\n")
52end 44end
53 45
54-- define the decoding filters 46-- define the decoding filters