Created
July 27, 2011 06:51
-
-
Save joseph-montanez/1108814 to your computer and use it in GitHub Desktop.
FastCGI example that doesn't work, well kind of
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program ffcgi; | |
{$mode objfpc}{$H+} | |
uses | |
fpWeb, fpfCGI, wmecho; | |
begin | |
Application.Title:='Gorilla3D'; | |
Application.Initialize; | |
Application.Port:= 9090; | |
Application.Run; | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddHandler fastcgi-script .fcgi | |
ScriptAlias /pas /home/joseph/fcgi/fprun | |
FastCgiExternalServer /home/joseph/fcgi/fprun -host 0.0.0.0:9090 -idle-timeout 30 -flush | |
<Directory /home/joseph/fcgi/> | |
Options +ExecCGI | |
AllowOverride None | |
Options None | |
Order allow,deny | |
Allow from all | |
</Directory> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
/usr/local/lib/fpc/2.4.4/ppc386 -g fprun.pas; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit wmecho; | |
{$mode objfpc}{$H+} | |
interface | |
uses | |
Classes, SysUtils, HTTPDefs, websession, fpHTTP, | |
fpWeb; | |
type | |
{ TEchoModule } | |
TEchoModule = class(TCustomHTTPModule) | |
procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); override; | |
procedure EchoModuleRequest(Sender: TObject; ARequest: TRequest; | |
AResponse: TResponse; var Handled: Boolean); | |
private | |
{ private declarations } | |
public | |
{ public declarations } | |
end; | |
var | |
EchoModule: TEchoModule; | |
implementation | |
uses webutil; | |
{ TEchoModule } | |
procedure TEchoModule.HandleRequest(ARequest : TRequest; AResponse : TResponse); | |
begin | |
end; | |
procedure TEchoModule.EchoModuleRequest(Sender: TObject; ARequest: TRequest; | |
AResponse: TResponse; var Handled: Boolean); | |
Var | |
S : TStrings; | |
begin | |
S:=TStringList.Create; | |
try | |
// Analyze request. | |
DumpRequest(ARequest,S); | |
// Optional, because default. | |
AResponse.ContentType:='text/html'; | |
AResponse.Contents:=S; | |
Handled:=True; | |
finally | |
S.Free; | |
end; | |
end; | |
initialization | |
RegisterHTTPModule(TEchoModule); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I access: http://localhost/pas
I get this response:
<title>Gorilla3D: Module Error</title>Gorilla3D: ERROR
The application encountered the following error:
$08076B33
$080B1085
$080B1671
$080480EC