[luci] using luci http library

Jesse Monroy jesse650 at gmail.com
Fri Sep 8 05:35:56 CEST 2017


The CGI method is not well defined. I'd like to know too.

Here is a blog post I wrote for the Yun.
http://codesnippets.altervista.org/documentation/yun/tutorials/bridge,restapi,jquery/bridge_and_restapi.html

I can also tell you that the socket for the server is in the /tmp directory,
at least on the Yun.

More notes here:
http://codesnippets.altervista.org/documentation/yun/index.html

Jesse

On 9/7/17, Levente <leventelist at gmail.com> wrote:
> I'd like to use the LUCI's http protocol parser library in an OpenWRT
> based system. What I want to achieve is to upload large files (10MB)
> to the system.
>
> I couldn't find any tutorial, only the API documentation.
>
> So I have my naive test script which obviously doesn't work. I get
> '502 Bad Gateway' error.
>
> Can you please help me how to implement this?
>
> #!/usr/bin/lua
>
>
> http = require "luci.http"
> proto = require "luci.http.protocol"
>
>
> local fileOpened = 0
> local fileP
>
> function filecb(t, data, isLast)
>
>     if fileOpened == 0 then
>         FileP = io.open("/tmp/blabla", "wb")
>         fileOpened = 1
>     end
>
>     FileP:write(data)
>
>     if isLast then
>         io.close(FileP)
>     end
>
> end
>
>
> src = http.source()
> httpMsg = proto.parse_message_header(src)
>
> proto.parse_message_body(src, httpMsg, filecb)
>
> http.close()
>
>
> Any help is welcome.
>
> Thank you,
> Levente
> _______________________________________________
> luci mailing list
> luci at lists.subsignal.org
> https://lists.subsignal.org/mailman/listinfo/luci
>


More information about the luci mailing list