On Thu, Jan 29, 2015 at 6:58 PM, Michael Van Canneyt <mich...@freepascal.org > wrote: > > On Thu, 29 Jan 2015, silvioprog wrote: > >> Hello, >> >> I've the same problem in Apache and nginx: TRequest.PathInfo always >> returns an empty string. >> >> In Apache, I'm using the the mod_proxy_fcgi module already distributed in >> Apache 24. In nginx, I'm using this configuration: >> >> location /dev/duallsms { >> fastcgi_pass localhost:8080; >> ... other configurations ... >> fastcgi_param PATH_INFO $fastcgi_path_info; # from nginx docs >> } >> >> 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?! >> > > PATH_INFO is not always available, you need to configure that in apache > and/or nginx. >
Thanks for the information. > See http://httpd.apache.org/docs/trunk/mod/mod_proxy_fcgi.html > > The FPC fcl-web components by themselves do not try to reconstruct > PATH_INFO. > You can try determining it from SCRIPT_URI or SCRIPT_NAME. 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: program project1; {$mode objfpc}{$H+} uses HttpDefs, custfcgi; type { TMyFCGIRequest } TMyFCGIRequest = class(TFCGIRequest) public property CGIParams; end; { TMyFCGIHandler } TMyFCGIHandler = class(TFCGIHandler) public function CreateRequest: TFCGIRequest; override; procedure HandleRequest(ARequest: TRequest; AResponse: TResponse); override; end; { TMyFCGIHandler } function TMyFCGIHandler.CreateRequest: TFCGIRequest; begin Result := TMyFCGIRequest.Create; end; procedure TMyFCGIHandler.HandleRequest(ARequest: TRequest; AResponse: TResponse); begin // open " http://localhost/dev/duallsms/pesquisa/contato?campo=nome&filtro=fulano" and get // the "REQUEST_URI: /dev/duallsms/pesquisa/contato?campo=nome&filtro=fulano" output AResponse.Contents.Text := 'REQUEST_URI: ' + TMyFCGIRequest(ARequest).CGIParams.Values['REQUEST_URI']; end; begin with TMyFCGIHandler.Create(nil) do try Port := 8080; Run; finally Free; end; end. -- Silvio Clécio My public projects - github.com/silvioprog
0001-fcl-web-extends-the-TFCGIRequest-class-allowing-to-u.patch
Description: Binary data
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal