diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
| commit | bce60be30fe8e9c1b0eb33128c23c93d7bca5303 (patch) | |
| tree | 3927343c777fcb7764a0f2f89754a0ceab141c21 /src/smtp.lua | |
| parent | d1a72435d5bd3528f3c334cd4d1da16dcead47bf (diff) | |
| download | luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.gz luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.bz2 luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.zip | |
Decent makefiles!
Diffstat (limited to 'src/smtp.lua')
| -rw-r--r-- | src/smtp.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/smtp.lua b/src/smtp.lua index 9a204d8..b39f5d6 100644 --- a/src/smtp.lua +++ b/src/smtp.lua | |||
| @@ -16,6 +16,7 @@ local os = require("os") | |||
| 16 | local socket = require("socket") | 16 | local socket = require("socket") |
| 17 | local tp = require("socket.tp") | 17 | local tp = require("socket.tp") |
| 18 | local ltn12 = require("ltn12") | 18 | local ltn12 = require("ltn12") |
| 19 | local headers = require("socket.headers") | ||
| 19 | local mime = require("mime") | 20 | local mime = require("mime") |
| 20 | module("socket.smtp") | 21 | module("socket.smtp") |
| 21 | 22 | ||
| @@ -146,10 +147,11 @@ end | |||
| 146 | local send_message | 147 | local send_message |
| 147 | 148 | ||
| 148 | -- yield the headers all at once, it's faster | 149 | -- yield the headers all at once, it's faster |
| 149 | local function send_headers(headers) | 150 | local function send_headers(tosend) |
| 151 | local canonic = headers.canonic | ||
| 150 | local h = "\r\n" | 152 | local h = "\r\n" |
| 151 | for i,v in base.pairs(headers) do | 153 | for f,v in base.pairs(tosend) do |
| 152 | h = i .. ': ' .. v .. "\r\n" .. h | 154 | h = (canonic[f] or f) .. ': ' .. v .. "\r\n" .. h |
| 153 | end | 155 | end |
| 154 | coroutine.yield(h) | 156 | coroutine.yield(h) |
| 155 | end | 157 | end |
