<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 29, 2015 at 6:58 PM, Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>
On Thu, 29 Jan 2015, silvioprog wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello,<br>
<br>
I've the same problem in Apache and nginx: TRequest.PathInfo always returns an empty string.<br>
<br>
In Apache, I'm using the the mod_proxy_fcgi module already distributed in Apache 24. In nginx, I'm using this configuration:<br>
<br>
location /dev/duallsms {<br>
fastcgi_pass localhost:8080;<br>
... other configurations ...<br>
fastcgi_param PATH_INFO $fastcgi_path_info; # from nginx docs<br>
}<br>
<br>
First I've tested it on Windows, but I've noticed that it fail in Linux too. So I ask: is PATH_INFO available in FastCGI (working as proxy)? If not, what I use instead it?!<br>
</blockquote>
<br></span>
PATH_INFO is not always available, you need to configure that in apache and/or nginx.<br></blockquote><div><br></div><div>Thanks for the information.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
See <a href="http://httpd.apache.org/docs/trunk/mod/mod_proxy_fcgi.html" target="_blank">http://httpd.apache.org/docs/<u></u>trunk/mod/mod_proxy_fcgi.html</a><br>
<br>
The FPC fcl-web components by themselves do not try to reconstruct PATH_INFO.<br>
You can try determining it from SCRIPT_URI or SCRIPT_NAME.</blockquote></div><div class="gmail_extra"><br></div><div class="gmail_extra">Hm... what do you think about to read it from the REQUEST_URI param? If it is good, you need to do a small change in FCL (if relevant hehe). The patch in attached allows to use the implementation below:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"><div class="gmail_extra">program project1;</div><div class="gmail_extra"><br></div><div class="gmail_extra">{$mode objfpc}{$H+}</div><div class="gmail_extra"><br></div><div class="gmail_extra">uses</div><div class="gmail_extra"> HttpDefs, custfcgi;</div><div class="gmail_extra"><br></div><div class="gmail_extra">type</div><div class="gmail_extra"><br></div><div class="gmail_extra"> { TMyFCGIRequest }</div><div class="gmail_extra"><br></div><div class="gmail_extra"> TMyFCGIRequest = class(TFCGIRequest)</div><div class="gmail_extra"> public</div><div class="gmail_extra"> property CGIParams;</div><div class="gmail_extra"> end;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> { TMyFCGIHandler }</div><div class="gmail_extra"><br></div><div class="gmail_extra"> TMyFCGIHandler = class(TFCGIHandler)</div><div class="gmail_extra"> public</div><div class="gmail_extra"> function CreateRequest: TFCGIRequest; override;</div><div class="gmail_extra"> procedure HandleRequest(ARequest: TRequest; AResponse: TResponse); override;</div><div class="gmail_extra"> end;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> { TMyFCGIHandler }</div><div class="gmail_extra"><br></div><div class="gmail_extra"> function TMyFCGIHandler.CreateRequest: TFCGIRequest;</div><div class="gmail_extra"> begin</div><div class="gmail_extra"> Result := TMyFCGIRequest.Create;</div><div class="gmail_extra"> end;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> procedure TMyFCGIHandler.HandleRequest(ARequest: TRequest; AResponse: TResponse);</div><div class="gmail_extra"> begin</div><div class="gmail_extra"> // open "<a href="http://localhost/dev/duallsms/pesquisa/contato?campo=nome&filtro=fulano">http://localhost/dev/duallsms/pesquisa/contato?campo=nome&filtro=fulano</a>" and get</div><div class="gmail_extra"> // the "REQUEST_URI: /dev/duallsms/pesquisa/contato?campo=nome&filtro=fulano" output</div><div class="gmail_extra"> AResponse.Contents.Text := 'REQUEST_URI: ' +</div><div class="gmail_extra"> TMyFCGIRequest(ARequest).CGIParams.Values['REQUEST_URI'];</div><div class="gmail_extra"> end;</div><div class="gmail_extra"><br></div><div class="gmail_extra">begin</div><div class="gmail_extra"> with TMyFCGIHandler.Create(nil) do</div><div class="gmail_extra"> try</div><div class="gmail_extra"> Port := 8080;</div><div class="gmail_extra"> Run;</div><div class="gmail_extra"> finally</div><div class="gmail_extra"> Free;</div><div class="gmail_extra"> end;</div><div class="gmail_extra">end.</div><div><br></div></div></div>--<br><div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>