OpenWrt Forum Archive

Topic: appweb package available for testing / review

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,

i made an appweb package available for testing. it contains the Mbedthis embedded web server (appWeb).

It was compiled statically with the following features:
· CGI
· EJS (Embedded JavaScript)
· ESP (Embedded Server Pages)

A system command was added to the ESP handler allowing commands to be executed in dynamic pages and their output captured and returned as string

you can find packages here, and the stuff needed to build the packages here.

--
Nico

Or would it be too big? > 250k

Aw, Thank you!!

i didn't get this running :-)

The package was updated to the latest stable release (1.2.0).
The static/copy handler was enabled, so the server can handle static content too.
The experimental upload module was compiled in.

The final static binary is around 350 KB.


Note: appWeb is a fast moving project, it integrates now with ucLinux, meaning that appWeb targets the embedded world and linux too. build process was greatly enhanced to support cross-compilation natively (i dropped most of my patches)
SSL support via MatrixSSL is on its way and should be released soon


Voilà

--
Nico

Hey Nico,

Cool, you fixed it :-)

to me, appWeb looks great. It's managable, its modular, its extendable.

I hope some people will pick up on it soon.

Nice work man, thnx

The packages was updated (again).

The build is now modular, with most features compiled as loadable modules, except the static/copy handler, and packaged separately.

access log is disabled (i guess it could fill up space quickly)

admin module was built, but didn't catch requests, so i didn't make it available


You should adjust the config. file after installing / removing modules.

--
Nico

cool, any chance you could make an ssl module for appweb based on matrixssl ?

i've been playing around with the ESP pages, but i just can't get the hang of their js implementation ...

cool, any chance you could make an ssl module for appweb based on matrixssl ?

As soon as it's released, i'm waiting for it too...

i've been playing around with the ESP pages, but i just can't get the hang of their js implementation

the implementation is missing a lot of features, but the good news is that it can be easily extended with some C++ classes. Just let me know what's lacking...

--
Nico

Some docs? :-)

I don't know js yet, and all the docs i can find online are for making applets.

fe I haven't found how to open a file for parsing (like /proc/meminfo)
So either I'm blind, or file manipulation is missing?

thnx Nico

Some pointers to javascript doc:
· Mozilla - JavaScript
· NJS JavaScript Interpreter - Documentation

So either I'm blind, or file manipulation is missing?

cruelly, but you can use the system function to read file content in a variable

<% content = system("/bin/cat /path/to/your/file"); %>

--
Nico

Hi all,

the package was updated to add an SSL handler using MatrixSSL.

--
Nico

Installed appWeb and tried to get matrixssl module working and it did not work. I edited appWeb.conf so that the module would be loaded like all the other modules and the error message indicates that the libmatrixSslmodule.so does not exist. All the other modules load and I get a working web server, but when i try to get matrixssl working it errors out. Any thoughts or what?

Any help would be appreciated.

The appweb matrixssl module was linked with a more recent package of the matrixssl library (SONAME was changed from libmatrixssl.so.1.2 to libmatrixssl.so.1)

Try this:

ln -s /usr/lib/libmatrixssl.so.1.2.1 /usr/lib/libmatrixssl.so.1

--
Nico

Thanks, its all working now.

I now need to compile a simple C program that allows form processing and email the results via ssmtp/sendmail. This program as written works in standard linux and I have compiled simple C programs that execute via a telnet shell, like the simple "Hello World" program. I also wrote a very simple program that when executed as a CGI program on a standard linux machine would produce a basic webpage, but not on the openwrt. Here is the code:

#include <stdio.h>

int main ( void )
{
    printf("Content-type: text/htmlnn");
    printf("<html>n");
    printf("n");
    printf("<head>n");   
    printf("</head>n");
    printf("<body>n");
    printf("this is a test");
    printf("</body>n");
    printf("</html>n");
    return(1);
}

This code does compile using the following commandline string:

/var/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-gcc test.c -mips2 -Os -fomit-frame-pointer -o test.cgi

And when executed at the command line produces the desired results. When executed from appWeb via the CGI interface it returns the following line in the error.log file:

default:1       Error: 503 "Service Unavailable" for "/cgi-bin/test.cgi", file "/web/cgi-bin/test.cgi": CGI process /cgi-bin/test.cgi: exited abnormally with exit code

So my question is that maybe this type of CGI script is not allowed by appWeb or that i need to use fprintf and redirect the pointer to the right location so that the output is displayed by the CGI interface.

Any help would be appreciated

bob

int main ( void )
{
...
    return(1);
}

The integer returned by main is the exit code, 0 for success and nonzero if an error occured or the program crashed.

Thanks, i changed the return code to 0 and all is fine.

Thanks

cruelly, but you can use the system function to read file content in a variable

<% content = system("/bin/cat /path/to/your/file"); %>

Nico

Hi Nico, I tried to use your esp_system patch with 1.2.3 yesterday, but while the patch applies cleanly whenever I call <% system(foo); %> the server barfs and I get this im my log:

default:1  p.0  Assertion flags & MPR_CMD_DISPOSED, failed (os.cpp:626)

any thoughts?

thanks

Forgot to say: this is on linux 2.6.9 glibc-2.3.2

There were significant changes in esp (embedded server pages) and ejs (embedded javascript) since 1.3.x.
I noticed the system function didn't work as expected in 1.2.x (for example, running 'ipkg status' in an esp script would cause the server to hang) so I decided to drop it...

My two cents advice would be to wait until they enhance esp and/or ejs to provide that kind of functionality, and stay with cgi in the meantime.

--
Nico

The discussion might have continued from here.