From 3ea92711269153916990d6cd7999bf436775e647 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Sun, 18 Jan 2004 08:59:21 +0000 Subject: [PATCH] Added new filter to code.c, to convert between line conventions. --- TODO | 5 +++-- etc/eol.lua | 9 +++++++++ src/http.lua | 2 +- test/httptest.lua | 3 +-- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 etc/eol.lua diff --git a/TODO b/TODO index 5566d16..91b8830 100644 --- a/TODO +++ b/TODO @@ -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 add connect with timeout 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 diff --git a/etc/eol.lua b/etc/eol.lua new file mode 100644 index 0000000..234cc4d --- /dev/null +++ b/etc/eol.lua @@ -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 diff --git a/src/http.lua b/src/http.lua index 2fc9e87..f51da25 100644 --- a/src/http.lua +++ b/src/http.lua @@ -419,7 +419,7 @@ end ----------------------------------------------------------------------------- local function authorize(reqt, parsed, respt) reqt.headers["authorization"] = "Basic " .. - socket.code.base64.encode(parsed.user .. ":" .. parsed.password) + (socket.code.b64(parsed.user .. ":" .. parsed.password)) local autht = { nredirects = reqt.nredirects, method = reqt.method, diff --git a/test/httptest.lua b/test/httptest.lua index d3a4dc0..96c9378 100644 --- a/test/httptest.lua +++ b/test/httptest.lua @@ -216,8 +216,7 @@ io.write("testing manual basic auth: ") request = { url = "http://" .. host .. prefix .. "/auth/index.html", headers = { - authorization = "Basic " .. - socket.code.base64.encode("luasocket:password") + authorization = "Basic " .. (socket.code.b64("luasocket:password")) } } expect = {