Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using CGI exe with IW
#11
(09-12-2019, 08:34 AM)Alexandre Machado Wrote: If it requires the query_string to be mode=top, then you need to make sure it is before calling it.

You will need to modify the query_string yourself and make sure it matches the spec.

You are free to alter Request.QueryFields. It is just a TStringList which can be cleared and filled by you, before calling the CGIRunner
Hi, Alexandre,

I did what you said but the cgirunner is returning nothing and I still have the error of reply type. The code is below.
May you point me more some directions aboiut what is wrong? Is there some other way to debug it?

I just tried with a simple  "test.bat"  and a click sync of a iwbutton  using that file with this content:
Code:
@echo off echo Content-type: text/plain echo. echo. echo Hi ! echo Your IP ADDRESS is %REMOTE_ADDR% and your BROWSER is %HTTP_USER_AGENT%

Regards, Luiz


Code:
var
  CGIRunner: TIWCGIRunner;
  CGIModuleName: string;
  LFileName,s: string;
begin
  CGIModuleName := TIWAppInfo.GetAppPath + 'wwwroot\cgi-bin\newweb\test.bat';
  CGIRunner := TIWCGIRunner.Create;
  try
    // Set the name of the CGI module which runs our report
    CGIRunner.CGIModule := CGIModuleName;
    // WebApplication.Request.QueryFields.Add('mode=top');
    // call the CGI application
    CGIRunner.Execute(WebApplication, WebApplication.Request);
    // Check status result. Zero indicates success. Anything else is an error
    if CGIRunner.StatusResult = 0 then
    begin
     
      s:=CGIRunner.ResponseContent.Text;
      //Here CGIRunner.ResponseContent.Text is returning nothing
      
      with WebApplication.Response do
        begin
        ResetReplyType;
        Code := 200;
        ContentType := MIME_HTML;
        
        WriteString(s); //Here I get an AV about ReplyType already set
        end;


    end else
    begin
      WebApplication.ShowMessage('Error creating report: ' + CGIRunner.ErrorMessage);
    end;
  finally
    CGIRunner.Free;
  end;
end;
Reply


Messages In This Thread
Using CGI exe with IW - by cprmlao@hotmail.com - 09-08-2019, 09:06 PM
RE: Using CGI exe with IW - by Alexandre Machado - 09-09-2019, 08:57 AM
RE: Using CGI exe with IW - by Alexandre Machado - 09-10-2019, 09:27 AM
RE: Using CGI exe with IW - by Alexandre Machado - 09-10-2019, 08:55 PM
RE: Using CGI exe with IW - by Alexandre Machado - 09-10-2019, 09:03 PM
RE: Using CGI exe with IW - by Alexandre Machado - 09-12-2019, 08:34 AM
RE: Using CGI exe with IW - by cprmlao@hotmail.com - 09-12-2019, 10:31 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-08-2019, 08:32 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-08-2019, 08:38 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-08-2019, 08:24 PM
RE: Using CGI exe with IW - by kudzu - 10-08-2019, 09:51 PM
RE: Using CGI exe with IW - by Alexandre Machado - 10-09-2019, 07:46 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-09-2019, 08:01 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-09-2019, 08:08 PM
RE: Using CGI exe with IW - by kudzu - 10-09-2019, 08:14 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)