[luci] using luci http library

Jesse Monroy jesse650 at gmail.com
Fri Sep 8 05:46:42 CEST 2017


I'd also like to note from my blog:

"""
The first time you load the webpage in firefox you'll see something
like this in the console. Chrome will have a similar display. If you
see [HTTP/1.1 500 OK XXXms], you have not started the sketch.
"""

On 9/7/17, Jesse Monroy <jesse650 at gmail.com> wrote:
> 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