Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IWCGIRunner not working with simple .bat cgi
#1
Hi, Alexandre,

I am fighting with IWCGIRunner and until now it is the winner.
I created a simple  "test.bat"  and I have used a  click sync of a iwbutton(IWBTNACAO) . The test.bat file has  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%"


First problem: IWCGIRunner is returning nothing. 
Second problem: When sending a response to browser with WriteString I get an AV of "replytype already set"

Please, what is wrong?


Code:
procedure TF_MyForm.IWBTNACAOClick(Sender: TObject);
begin
var
  CGIRunner: TIWCGIRunner;
  CGIModuleName: string;
  s: string;
begin
  CGIModuleName := TIWAppInfo.GetAppPath + 'wwwroot\cgi-bin\test.bat';
  CGIRunner := TIWCGIRunner.Create;
  try
    // Set the name of the CGI module which runs our report
    CGIRunner.CGIModule := CGIModuleName;
    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;
      //Problem here: CGIRunner.ResponseContent.Text is empty
      with WebApplication.Response do
        begin
        ResetReplyType;
        Code := 200;
        ContentType := MIME_HTML;
        WriteString(s); //Problem here: Here I get an AV about ReplyType already set
        end
    end else
    begin
      WebApplication.ShowMessage('Error on test.bat: ' + CGIRunner.ErrorMessage);
    end;
  finally
    CGIRunner.Free;
  end;
end;
end;
Reply
#2
I think this has been clarified in another thread
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)