aboutsummaryrefslogtreecommitdiff
path: root/src/mime.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2005-06-12 22:02:21 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2005-06-12 22:02:21 +0000
commit8b114f3bf4ccea3b065551fa94649a9e45935b5b (patch)
tree06f2faa7e896e9434ba89ec68445ea56e6c8c6dc /src/mime.lua
parentb22f6f3830515a57a8776e7489b3e2d434abd12f (diff)
downloadluasocket-8b114f3bf4ccea3b065551fa94649a9e45935b5b.tar.gz
luasocket-8b114f3bf4ccea3b065551fa94649a9e45935b5b.tar.bz2
luasocket-8b114f3bf4ccea3b065551fa94649a9e45935b5b.zip
Stupid bug in http.lua.
Diffstat (limited to 'src/mime.lua')
-rw-r--r--src/mime.lua32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/mime.lua b/src/mime.lua
index 6492a96..6ef82b8 100644
--- a/src/mime.lua
+++ b/src/mime.lua
@@ -15,9 +15,9 @@ local mime = require("cmime")
15module("mime") 15module("mime")
16 16
17-- encode, decode and wrap algorithm tables 17-- encode, decode and wrap algorithm tables
18mime.encodet = {} 18encodet = {}
19mime.decodet = {} 19decodet = {}
20mime.wrapt = {} 20wrapt = {}
21 21
22-- creates a function that chooses a filter by name from a given table 22-- creates a function that chooses a filter by name from a given table
23local function choose(table) 23local function choose(table)
@@ -32,21 +32,21 @@ local function choose(table)
32end 32end
33 33
34-- define the encoding filters 34-- define the encoding filters
35mime.encodet['base64'] = function() 35encodet['base64'] = function()
36 return ltn12.filter.cycle(b64, "") 36 return ltn12.filter.cycle(b64, "")
37end 37end
38 38
39mime.encodet['quoted-printable'] = function(mode) 39encodet['quoted-printable'] = function(mode)
40 return ltn12.filter.cycle(qp, "", 40 return ltn12.filter.cycle(qp, "",
41 (mode == "binary") and "=0D=0A" or "\r\n") 41 (mode == "binary") and "=0D=0A" or "\r\n")
42end 42end
43 43
44-- define the decoding filters 44-- define the decoding filters
45mime.decodet['base64'] = function() 45decodet['base64'] = function()
46 return ltn12.filter.cycle(unb64, "") 46 return ltn12.filter.cycle(unb64, "")
47end 47end
48 48
49mime.decodet['quoted-printable'] = function() 49decodet['quoted-printable'] = function()
50 return ltn12.filter.cycle(unqp, "") 50 return ltn12.filter.cycle(unqp, "")
51end 51end
52 52
@@ -60,29 +60,29 @@ local function format(chunk)
60end 60end
61 61
62-- define the line-wrap filters 62-- define the line-wrap filters
63mime.wrapt['text'] = function(length) 63wrapt['text'] = function(length)
64 length = length or 76 64 length = length or 76
65 return ltn12.filter.cycle(wrp, length, length) 65 return ltn12.filter.cycle(wrp, length, length)
66end 66end
67mime.wrapt['base64'] = wrapt['text'] 67wrapt['base64'] = wrapt['text']
68mime.wrapt['default'] = wrapt['text'] 68wrapt['default'] = wrapt['text']
69 69
70mime.wrapt['quoted-printable'] = function() 70wrapt['quoted-printable'] = function()
71 return ltn12.filter.cycle(qpwrp, 76, 76) 71 return ltn12.filter.cycle(qpwrp, 76, 76)
72end 72end
73 73
74-- function that choose the encoding, decoding or wrap algorithm 74-- function that choose the encoding, decoding or wrap algorithm
75mime.encode = choose(encodet) 75encode = choose(encodet)
76mime.decode = choose(decodet) 76decode = choose(decodet)
77mime.wrap = choose(wrapt) 77wrap = choose(wrapt)
78 78
79-- define the end-of-line normalization filter 79-- define the end-of-line normalization filter
80function mime.normalize(marker) 80function normalize(marker)
81 return ltn12.filter.cycle(eol, 0, marker) 81 return ltn12.filter.cycle(eol, 0, marker)
82end 82end
83 83
84-- high level stuffing filter 84-- high level stuffing filter
85function mime.stuff() 85function stuff()
86 return ltn12.filter.cycle(dot, 2) 86 return ltn12.filter.cycle(dot, 2)
87end 87end
88 88