No that does not help.
Here is the code of my program CGI2
{$mode objfpc}{$H+}
interface
uses
SysUtils, Classes, httpdefs, fpHTTP, fpWeb,fpWebFile;
type
{ TFPWebModule1 }
TFPWebModule1 = class(TFPWebModule)
procedure ShowRequest(Sender: TObject; ARequest: TRequest;
AResponse: TResponse; var Handled: Boolean);
private
{ private declarations }
public
{ public declarations }
end;
var
FPWebModule1: TFPWebModule1;
implementation
{$R *.lfm}
{ TFPWebModule1 }
procedure TFPWebModule1.ShowRequest(Sender: TObject; ARequest: TRequest;
AResponse: TResponse; var Handled: Boolean);
begin
AResponse.ContentType := 'text/html;charset=utf-8';
AResponse.Contents.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'public_html/test.html');
Handled:= TRUE;
end;
initialization
RegisterFileLocation('public_html','/srv/www/cgi-bin/');
RegisterHTTPModule('TFPWebModule1', TFPWebModule1);
end.
CGI2 is in /srv/www/cgi-bin/
In /srv/www/cgi-bin/public_html are 2 files my.css and test.html
test.html:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="my.css">
</head>
<body>
<p>Programmers of the world unite!</p>
</body>
</html>
my.css:
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
If in FireFox the url localhost/cgi-bin/cgi2/TFPWebModule1/Show is given I see the characters on a white field.
So the css is not used.
IF in FireFox I give as url file:///srv/www/cgi-bin/public_html/test.html I see the file in all its glory
How can I use the css?