blob: 901ea8306cb9f2c14b1e0ff46833fd3aac9c6a69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
{$mode objfpc}
{$H+}
program testhttp;
uses
SysUtils, fphttpapp, fpwebfile;
Procedure Usage;
begin
Writeln('Usage : testhttp DocumentRoot [Port]');
Writeln('Where');
Writeln(' Documentroot location to serve files from. It is mapped to location /files');
Writeln(' Port port to listen on (default 8080)');
Halt(1);
end;
begin
if (ParamCount<1) or (ParamCount>2) then
usage;
if (ParamCount=2) and (StrToIntDef(ParamStr(2),-1)=-1) then
usage;
RegisterFileLocation('files',ParamStr(1));
{$ifdef unix}
MimeTypesFile:='/etc/mime.types';
{$endif}
Application.Initialize;
Application.Port:=StrTointDef(ParamStr(2),8080);
Application.Title:='HTTP Demo application';
Application.Run;
end.
|