[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Problem with Luasocket 2.0.2 mime.b64/mime.unb64
- From: Martin Dahlberg <Martin.Dahlberg@...>
- Date: Wed, 24 Mar 2010 17:35:19 +0100
Hi!
First of all I am sorry for the lengthy post, but I want to include for clarity.
I have compiled Lua5.1 for WIN32 with LUAL_BUFFSIZE as 512 and I'm using LuaSocket2.0.2.
Then I run the following Lua lines in interactive mode:
-- to create a long string of alphabet letters
all='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'
s='' for i=1,386 do local j =((i-1) % #all)+1 s = s .. all:sub(j,j) end
mime = require("mime")
-- 386 bytes is OK
if s == (mime.unb64((mime.b64(s)))) then print("OK") end
-- now the problem, that starts at 387 bytes
i=387 do local j =((i-1) % #all)+1 s = s .. all:sub(j,j) end
if s ~= (mime.unb64((mime.b64(s)))) then print("FAIL") end
print(s,"\n")
print((mime.b64(s)),"\n")
print((mime.unb64((mime.b64(s)))),"\n")
I get the printout:
OK
FAIL
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO
QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVowMTIzNDU2Nzg5YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0R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JTVFVWV1hZWjAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSk
It looks like the result from mime.unb64 contains the decoded data + 512 bytes of unencoded data. Almost as if I had called mime.unb64 with 2 arguments.
Any help appreciated!
Many thanks,
Martin