Couple bug fixes.

This commit is contained in:
Diego Nehab
2007-03-12 04:08:40 +00:00
parent 8bf9fb51dd
commit be2e467929
11 changed files with 77 additions and 74 deletions

View File

@@ -119,9 +119,8 @@ check_request(request, expect, ignore)
------------------------------------------------------------------------
io.write("testing invalid url: ")
local c, e = socket.connect("", 80)
local r, re = http.request{url = host .. prefix}
assert(r == nil and e == re)
local r, e = http.request{url = host .. prefix}
assert(r == nil and e == "invalid host ''")
r, re = http.request(host .. prefix)
assert(r == nil and e == re, tostring(r) ..", " .. tostring(re) ..
" vs " .. tostring(e))

View File

@@ -101,7 +101,7 @@ control:setoption("tcp-nodelay", true)
------------------------------------------------------------------------
function test_methods(sock, methods)
for _, v in methods do
for _, v in pairs(methods) do
if type(sock[v]) ~= "function" then
fail(sock.class .. " method '" .. v .. "' not registered")
end

View File

@@ -12,7 +12,7 @@ source = smtp.message {
headers = { ['content-type'] = 'multipart/alternative' },
body = {
[1] = {
headers = { ['content-type'] = 'text/html' },
headers = { ['Content-type'] = 'text/html' },
body = "<html> <body> Hi, <b>there</b>...</body> </html>"
},
[2] = {
@@ -60,7 +60,7 @@ source = smtp.message{
-- chunks are loaded into memory and translation happens on the fly.
[2] = {
headers = {
["content-type"] = 'image/png; name="luasocket.png"',
["ConTenT-tYpE"] = 'image/png; name="luasocket.png"',
["content-disposition"] = 'attachment; filename="luasocket.png"',
["content-description"] = 'a beautiful image',
["content-transfer-encoding"] = "BASE64"
@@ -83,10 +83,10 @@ r, e = smtp.send{
"<diego@princeton.edu>" },
from = "<diego@princeton.edu>",
source = ltn12.source.chain(source, filter),
server = "mail.cs.princeton.edu",
--server = "localhost",
--port = 2525
port = 25
--server = "mail.cs.princeton.edu",
--port = 25
server = "localhost",
port = 2525
}
print(r, e)