<html>
<head>
<style>
.sw_message P{margin:0px;padding:0px;}
.sw_message {FONT-SIZE: 12pt;FONT-FAMILY:Tahoma,Arial,Helvetica,sans-serif;background:white;}
.sw_message blockquote{margin-left:5px;padding-left:5px;border-left:2px solid #144fae;color: #144fae;}
.sw_message blockquote blockquote{border-left:2px solid #006312;color: #006312;}
.sw_message blockquote blockquote blockquote{border-left:2px solid #8e5656;color: #8e5656;}
.sw_message blockquote blockquote blockquote blockquote{border-left:2px solid #888;color: #888;}
</style>
</head>
<body class="sw_message">
<div> </div><div> </div><div id="editor_signature">Regards,<div> - Graeme -</div><div><br></div><br></div><div> </div><div>On Monday 28/10/2013 at 11:38, Michael Van Canneyt wrote: </div><blockquote type="cite"><span style="font-size: 12pt;">Damn windows Firewall :(</span></blockquote><div><br></div><div>That's what I thought too... but maybe I was wrong. My bad!</div><div> </div><blockquote type="cite"><span style="font-size: 12pt;">Does the request arrive at all in the webserver app ? i.e. does the Accept() call return ?</span></blockquote><div><br></div><div>For some reason I was concentrating on debugging the CGI client applications, thinking the problem is maybe there, or a Windows Firewall or Windows permission issue. After reading your reply I adding loads of debug log() lines in the webserver app, and it seems that the repeat...until loop that reads the TProcess output from the CGI app never exits. Any ideas on why this is for Vista or Win7 OSes?</div><div><br></div><div><br></div><div>Here is the code that executes the CGI app, reads the CGI output and sends the Response content.</div><div> </div><div>---------------------------</div><div><div>procedure TFPCustomCGIModule.ExecuteCGIApp(ARequest: TRequest;</div><div> AResponse: TResponse; const ACGIApp: string);</div><div>const</div><div> BufSize = 1024;</div><div>var</div><div> p: TProcess;</div><div> Buf: string;</div><div> Count: integer;</div><div> lResponse: string;</div><div> i: integer;</div><div>begin</div><div> Log('>> TFPCustomCGIModule.ExecuteCGIApp', lsDebug);</div><div> p := TProcess.Create(nil);</div><div><br></div><div> with p.Environment do</div><div> begin</div></div><div> // set lots of environment variables required for CGI applications to work</div><div> ...snip...</div><div> end;</div><div><br></div><div><div> p.Options := [poUsePipes, poStdErrToOutPut, poNoConsole];</div><div> p.ShowWindow := swoShowNormal;</div><div> p.CurrentDirectory := ExtractFilePath(ACGIApp);</div><div> p.CommandLine := ACGIApp + ' ' + ARequest.QueryString;</div><div> try</div><div> p.Execute;</div><div> Log('p.Execute called', lsDebug); // <---- I see this is the log output, but nothing further...</div><div> { Now process the output }</div><div> lResponse := '';</div><div> SetLength(Buf,BufSize);</div><div> repeat</div><div> if (p.Output<>nil) then</div><div> begin</div><div> Count := p.Output.Read(Buf[1],Length(Buf));</div><div> lResponse := lResponse + Copy(Buf,1, Count);</div><div> end</div><div> else</div><div> Count:=0;</div><div> until Count=0;</div><div> Log('repeat..until Count=0 returned', lsDebug); // <----- Under Vista and Win7 it never gets here??</div><div> p.WaitOnExit;</div><div> Log('p.WaitOnExit returned', lsDebug);</div><div> finally</div><div> p.Free;</div><div> AResponse.Content := lResponse;</div><div> AResponse.Code := p.ExitStatus;</div><div> Log('About to do: AResponse.SendContent', lsDebug);</div><div> AResponse.SendContent;</div><div> Log('Content successfully sent!', lsDebug);</div><div> AResponse.ContentStream := nil;</div><div> end;</div><div> Log('<< TFPCustomCGIModule.ExecuteCGIApp', lsDebug);</div><div>end;</div></div><div>---------------------------</div><div><br></div><div><br></div><div>I'm using FPC 2.6.2 32-bit. I'm going to compare my "reading console output" code to the code found in TIOStream class (which I only discovered a few days ago). Maybe that reveals something I'm doing wrong.</div><div><br></div><div><br></div><div>Regards,</div><div> Graeme.</div><div><br></div><div><br></div>
</body></html>