Thanks Michael!

Looks like libwebsockets *is* ported to NuttX already - but you have to enable MIT licensed software (and a few other things to do with TLS and CRYPTO stuff) first, but it could well be an option: I'll take a look :-)

In the meantime I have a theory as to why the thttp CGI scripts/apps fail to send output to the browser: I think the app task is killed before the queued output data is sent. I will look at this today and it could be that a fix is easier than I feared.

Regards,

TimH

On 27/06/2025 07:47, Michael Jung wrote:
Hi Tim,

you wrote:
> Anyone know of a lightweight webserver that will handle POST and that runs under NuttX?

I was very impressed by libwebsockets, when I was using it on NuttX a couple of years ago. It is not exactly lightweight, and much more than a webserver, but it is a perfect infrastructure component for implementing Web UIs for embedded applications. There is probably quite some porting effort to do, but you might want to have a look:

https://github.com/warmcat/libwebsockets

Bye,
Michael

On Thu, Jun 26, 2025 at 8:07 PM Tim Hardisty <t...@jti.uk.com.invalid> wrote:

    Update as I am back on this after a break and still stumped.

    uIP:

      * only supports GET method
      * HTML5 maps PUT to GET which is why I found either caused my
        CGI app to run
      * But no support for getting the data itself as...it only
        supports the GET method

    thttpd:

      * supports POST, and calls my CGI app where I can save the file
        that's sent
      * Any calls to puts or printf from within the CGI app fail.
        There are pipes in place for stdout but the piped/opened file
        reports as unwriteable.

    So uIP no use without work; thttpd is broken (issue raised on github)

    Anyone know of a lightweight webserver that will handle POST and
    that runs under NuttX?

    On 05/06/2025 16:50, Tim Hardisty wrote:

    Make that "PUT" not "GET", of course.

    On 05/06/2025 15:42, Tim Hardisty wrote:
    And...the magic answer to make this form actually work with the
    uIP webserver is that:

     1.  the form's "method" has to be GET not POST otherwise the
    URL CGI
       "call" is not made visible/sent correctly/processed.
    2. the webserver has to be configured with URL/CGI mapping enabled
       (CONFIG_NETUTILS_CGIPATH)


    On 31/05/2025 11:16, Tim Hardisty wrote:

    I'm using the netutils uIP webserver to provide a simple
    interface, served by my board, for configuration, log
    downloads, firmware updates, etc.

    Forgive me if the terminology is wrong here, but I am trying to
    find documentation - NuttX or elsewhere - about the %! "tag"
    that denotes a call to a CGI function. Specifically, I am
    trying to add a form that calls a script from a button, where
    do-firmware-update is my CGI function:

    <form action="%! do-firmware-update" method="post"
    enctype="multipart/form-data" accept-charset="UTF-8">

    This gets served with nothing after the first opening quote
    character on this line so i am assuming I am "calling" the
    script incorrectly but can't find anything anywhere to tell me
    how to do this.

    Can anyone point me in the right direction?

    Thanks!

    TimH





        
        
        
        
        


--
    Regards,

    Tim Hardisty


    A picture containing text, clipart Description automatically generated

        

    +44 (0) 1305 534535

        

    <http://www.jti.uk.com/>

        

    JTi.uk.com <https://www.jti.uk.com/>

        

    <https://www.facebook.com/JTinnovations/>

        

    \JTinnovations <https://www.facebook.com/JTinnovations/>

    JT Innovations Ltd.

    Registered office: 36 East St, Weymouth, Dorset, DT3 4DT, UK.

    Company number 7619086

    VAT Registration GB 111 7906 35

Reply via email to