CGI script execution error

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • CGI script execution error

    I am looking for an example of IP/ webserver to execute CGI script. I downloaded example for windows.
    I changed definition for WEBS_Application to accept additional argument for virtual files.

    C Source Code

    1. typedef struct { const WEBS_CGI * paCGI; WEBS_ACCESS_CONTROL * paAccess; void (*pfHandleParameter)(WEBS_OUTPUT * pOutput, const char * sPara, const char * sValue); const WEBS_VFILES * paVFiles;} WEBS_APPLICATION;



    Also added definition for virtual files

    C Source Code

    1. typedef struct { const char * sName; // e.g. "Counter.cgi" void (*pf)(WEBS_OUTPUT * pOutput, const char * sParameters);} WEBS_VFILES;



    Then in WebServer_Win32.c I added definition for Send handler and updated application

    C Source Code

    1. static void _callback_SendCGI(WEBS_OUTPUT * pOutput, const char * sParameters) {..Removed for brevity..}
    2. static const WEBS_VFILES _aVFiles[] = { {"Send.cgi", _callback_SendCGI }, NULL};
    3. static const WEBS_APPLICATION _Application = { &_aCGI[0], &_aAccessControl[0], _CB_HandleParameter, &_aVFiles[0]};



    With this when I call localhost:8080/Send.cgi?FirstName=Sriharsha&LastName=Vardhan , I am getting

    Not Found
    The requested document was not found on this server.


    Can you please guide me on where I am going wrong?
  • CGI script execution error

    OK. I could fix it. In server thread I got to register FileInfo callback routine before creating Process.

    IP_WEBS_SetFileInfoCallback(_pfGetFileInfo)

    IP_WEBS_Process(_Send, _Recv, Context, _pFS_API, ......

    Then I got to specify definition for "WEBS_PARA_BUFFER_SIZE" in WEBS_Conf.h
    #define WEBS_PARA_BUFFER_SIZE 128


    These two changes were missing.

    Execution of CGI scripts as virtual files works with these changes.