[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LunarCGI (was Re: CGI.lua - A native CGI Interface)
- From: Sebastien Lai <237482@...>
- Date: Tue, 27 Sep 2011 08:32:34 +0200
Hey, I'm happy to announce that I finally found a pure Lua way to
parse multipart in LunarCGI!
The code is 'borrowed' from the LuaCheia project
(http://luacheia.lua-users.org/, src/modules/cgi/cgi.lua).
So far, it works flawlessly, except for one major problem:
I'm unable to split the data correctly :(
The data returned by LunarCore.process_multipart_post looks like this
(returned as key->value table):
Content-Type: text/plain
<actual content of the file>
That is, 'Content-Type: <mimetype>' + two newlines + actual data.
I haven't been able to properly split the Content-Type from the data,
since my knowledge of Lua pattern matching is rather limited.
I tried to split it with string.gfind: string.gfind(s, "Content-Type:
%a+/%a+\n\n(.-)"), with no avail, and I'm seriously lost here.
I've asked on IRC as well, but apparently it's either a little bit too
early (or too late?) right now, and i'm stuck.
In the current version
(https://github.com/beelzebub/LunarCGI/blob/master/LunarCGI.lua#L185)
I tried to split it the oldfashioned way with LunarCore.split(),
however, that didn't work either.
If anyone is more handy with Lua pattern matching than me, I would
appreciate a little help here :-)
Apart from that, File uploads will be available pretty much as soon as
this problem is solved :-)