Added new filter to code.c, to convert between line conventions.

This commit is contained in:
Diego Nehab 2004-01-18 08:59:21 +00:00
parent 50ce143725
commit 3ea9271126
4 changed files with 14 additions and 5 deletions

5
TODO
View File

@ -1,9 +1,10 @@
write some utilities that use the code.lua module and put them
in etc, modify the README.etc file and makefile.dist (eol.lua is done)
check for interrupt compliance check for interrupt compliance
add connect with timeout add connect with timeout
add gethostname and use it in HTTP, SMTP etc, and add manual entry. add gethostname and use it in HTTP, SMTP etc, and add manual entry.
add thanks for cassino and david burgess
add local connect, and manual entry add local connect, and manual entry

9
etc/eol.lua Normal file
View File

@ -0,0 +1,9 @@
marker = {['-u'] = '\10', ['-d'] = '\13\10'}
arg = arg or {'-u'}
marker = marker[arg[1]] or marker['-u']
local convert = socket.code.canonic(marker)
while 1 do
local chunk = io.read(4096)
io.write(convert(chunk))
if not chunk then break end
end

View File

@ -419,7 +419,7 @@ end
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
local function authorize(reqt, parsed, respt) local function authorize(reqt, parsed, respt)
reqt.headers["authorization"] = "Basic " .. reqt.headers["authorization"] = "Basic " ..
socket.code.base64.encode(parsed.user .. ":" .. parsed.password) (socket.code.b64(parsed.user .. ":" .. parsed.password))
local autht = { local autht = {
nredirects = reqt.nredirects, nredirects = reqt.nredirects,
method = reqt.method, method = reqt.method,

View File

@ -216,8 +216,7 @@ io.write("testing manual basic auth: ")
request = { request = {
url = "http://" .. host .. prefix .. "/auth/index.html", url = "http://" .. host .. prefix .. "/auth/index.html",
headers = { headers = {
authorization = "Basic " .. authorization = "Basic " .. (socket.code.b64("luasocket:password"))
socket.code.base64.encode("luasocket:password")
} }
} }
expect = { expect = {