09-12-2019, 10:31 AM
(This post was last modified: 09-12-2019, 06:35 PM by cprmlao@hotmail.com.)
(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.Hi, Alexandre,
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
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;