More than a starting point, I think. The parse_message_body function in this can be reused in an WSAPI program by making an LTN12 source for wsapi_env.input, which should be easy, plus passing { env = wsapi_env } as the msg parameter, and your file upload callback.
The LTN12 module is part of LuaSocket. -- Fabio Mascarenhas 2010/9/3 Ignacio Burgueño <iburgu...@gmail.com>: > On Fri, Sep 3, 2010 at 5:49 AM, ykhuang <ykhu...@gmail.com> wrote: >> >> Hi, >> I wrote a WSAPI script to handle POST upload and it works fine with files >> under size of 4M. >> When I increase the upload size to 8M, the WSAPI ran out of memory when >> executing >> local request = wsapi.request.new(wsapi_env) >> I thought it exited when executing parse_post_data(), is it a limitation >> of WSAPI or Lua? >> Any suggestion to handle large upload file? > > Take a look at this: > https://luci.subsignal.org/trac/browser/luci/trunk/libs/http/luasrc/http/protocol.lua > It handles file uploads without the need to have the whole file in memory. > It might give you a starting point. > Regards, > Ignacio > _______________________________________________ > Kepler-Project mailing list > Kepler-Project@lists.luaforge.net > http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project > http://www.keplerproject.org/ > _______________________________________________ Kepler-Project mailing list Kepler-Project@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/