Hello listers,

I am trying to understand how to create some code using Custcgi. However, the following peace is not clear for me concerning to "getnextpathinfo". Let's see:

program cgiproject1;

{$mode objfpc}{$H+}

uses
  HTTPDefs, custweb, custcgi, main;

type

  { TMyCGIHandler }

  TMyCGIHandler = class(TCGIHandler)
  public
    procedure HandleRequest(AReq: TRequest; ARes: TResponse); override;
  end;

  TMyCGIApp = class(TCustomCGIApplication)
  protected
    function InitializeWebHandler: TWebHandler; override;
  end;

procedure TMyCGIHandler.HandleRequest(AReq: TRequest; ARes: TResponse);
begin
  if AReq.GetNextPathInfo = 'test' then
    CGITest(AReq, ARes)
  else
    CGIAbreHtml(AReq, ARes);
end;

function TMyCGIApp.InitializeWebHandler: TWebHandler;
begin
  Result := TMyCGIHandler.Create(self);
end;

begin
  With TMyCGIApp.Create(Nil) do
    try
      Initialize;
      Run;
    finally
      Free;
    end;
end.

The code seems to be logical. I created a tCGIApplication derived from tCustomApplication, in other words, the object responsible for the program initialization.

By means of "initializeWebHandler", a tCGIHandler object is created. Of course, this is the responsible for requests and responses handling.

Everything is good until:

if AReq.GetNextPathInfo = 'test' then
    CGITest(AReq, ARes)
  else
    CGIAbreHtml(AReq, ARes);
en

What does it mean "AReq.GetNextPathInfo = 'test'"?

Best regards,

Luciano
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to