diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-15 06:24:00 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-15 06:24:00 +0000 |
commit | 58096449c6044b7aade5cd41cfd71c6bec1d273d (patch) | |
tree | 1814ffebe89c4c2556d84f97f66db37a7e8b4554 /src/mime.lua | |
parent | 9ed7f955e5fc69af9bf1794fa2c8cd227981ba24 (diff) | |
download | luasocket-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.lua | 14 |
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 | ----------------------------------------------------------------------------- | ||
12 | local open = assert(loadlib("mime", "luaopen_mime")) | ||
13 | local mime = assert(open()) | ||
14 | |||
15 | ----------------------------------------------------------------------------- | ||
16 | -- Load other required modules | 9 | -- Load other required modules |
17 | ----------------------------------------------------------------------------- | 10 | ----------------------------------------------------------------------------- |
11 | local mime = requirelib("mime", "luaopen_mime", getfenv(1)) | ||
18 | local ltn12 = require("ltn12") | 12 | local 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 |
24 | setmetatable(mime, { __index = _G }) | ||
25 | setfenv(1, mime) | ||
26 | 18 | ||
27 | -- encode, decode and wrap algorithm tables | 19 | -- encode, decode and wrap algorithm tables |
28 | encodet = {} | 20 | encodet = {} |
@@ -48,7 +40,7 @@ end | |||
48 | 40 | ||
49 | encodet['quoted-printable'] = function(mode) | 41 | encodet['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") |
52 | end | 44 | end |
53 | 45 | ||
54 | -- define the decoding filters | 46 | -- define the decoding filters |