lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, Feb 25, 2011 at 8:15 PM, Peter Odding <> wrote:
Hi Sebastien,

I suppose that file upload support will not be available for a very long
time until I have figured out a sane way to

    1. Parse the raw multipart/formdata properly
    2. actually extract non-formdata (which, just so it happens, is
delivered *exactly* the same way as files are delivered...)
    3. ^^^^^^^^^^^^^ do all that without boilingplate code or risking
crossplatform availability

Currently, that seems like a fairly impossible target, considering that
Perl for example, makes heavy use of its regular _expression_ engine to
parse the data properly.

I'm not sure what cross platform availability means to you (plain Lua only, Windows + UNIX, mainframes, commodore 64 ;-) but you could consider using a proven C parser for multipart/formdata input. You can make it optional so that LunarCGI still works without the binary module (i.e. on all platforms that support Lua) but with reduced functionality in case the binary module is not available.

A bit of searching [1] tells me that there are several C libraries which seem to support this: GMime [2], mimetic [3], cgicc [4] and libapreq [5]. I haven't looked around for Lua bindings to any of these but I'm actually considering writing a binding to libapreq so that I can implement a full featured web server using my Lua/APR binding [6]. If you're interested in such a binding I could probably make it standalone from my (large) Lua/APR binding.

Hi Peter,

I'd be very interested in a lua binding for libapreq, it is a very useful library for people involved in web development. I think it would also be useful to other lua web related projects if you manage to keep it standalone. Please let me in the know. TIA.

Bertrand Mansion