OpenWrt Forum Archive

Topic: Can't do a HTML Form post with appWeb Web server

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

I'm writing very simple C code to see what I can do with the appWeb server via the cgi module. Here is the code:

/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */

#include <stdio.h>

/* ------------------------------------------------------------------------ */

int main( int argc, char *argv[] )
{
    char    pszStr[1000];
    char    pszStr1[1000];
    int     iCnt;
    char    cChr;

//    while ( iCnt < 50 )
//    {
//        cChr = getc(stdin);
//        pszStr1[iCnt] = cChr;
//        ++iCnt; 
//    }
//    pszStr1[iCnt] = 0;

    printf("Content-type: text/htmlnn");
    printf("<html>n");
    printf("<head>n");
    printf("</head>n");
    printf("<body>n");
    printf("post: %s<br><br>",pszStr1);
    iCnt = 0;
    while ( iCnt < argc )
    {
        strcpy(pszStr,argv[iCnt]);
        printf("%s<br>",pszStr);
        ++iCnt;
    }

    printf("</body>n");
    printf("</html>n");
    return(0);
}

/* --------------------------------------------------------------------------- */

It compiles fine and when doing a request method of "get" it displays the result in the web browser, but there are limits to the amount sent this way. What I really want to do is use a "post" and read the results from the "stdin", but it gives me a error in the browser that the page can't be displayed. Any thoughts would be appreciated.

Well i gave up on appWeb because it just didn't work. Then I tried thttpd and it didn't work either. Then i compiled mini_httpd and it worked.

All i'm trying to do is just compile a "C program" as a cgi script and be able to process form post and get command line information. It looks like mini_httpd is the way to go.

I can offer mini_httpd as a ipkg if anybody is interested.

bob

I can offer mini_httpd as a ipkg if anybody is interested.
bob

I also tried appweb 1.2 and 1.3 getting always a segmentation fault. Now i was trying thttpd, but I would be glad of a mini_httpd ipk package for trying.

see you,

Daniel

Well appWeb and thttpd each worked great, but not with CGI executables when a HTML form post is done. Mini_httpd works great for this situation.

I can package it, but I only compiled it without the SSL but I'm using stunnel and it works great.

bob

I mildly understand what you're talking about, and would like to ask for your help with one of my problems.  I'd like to use nocatsplash to serve a page hosted on the router (html?) that can write information entered in a form to a textfile on the router.  Would a cgi or html submission work? thanks

The discussion might have continued from here.