Skip to content

Commit 490de80

Browse files
committed
initial implementation of using indy http server
1 parent ea8688b commit 490de80

File tree

15 files changed

+882
-84
lines changed

15 files changed

+882
-84
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
{------------ Begin TFpHttpServer-related------------------}
10+
FpwebSvrConfigTypes,
11+
FpwebAppServiceProviderImpl,
12+
FpwebStdOutWriterImpl,
13+
FpwebRequestImpl,
14+
FpwebRequestFactoryImpl,
15+
FpwebProcessorImpl,
16+
{------------ End TFpHttpServer-related------------------}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
{------------ Begin TFpHttpServer-related------------------}
10+
TFpwebSvrConfig = FpwebSvrConfigTypes.TFpwebSvrConfig;
11+
TFpwebAppServiceProvider = FpwebAppServiceProviderImpl.TFpwebAppServiceProvider;
12+
TFpwebStdOutWriter = FpwebStdOutWriterImpl.TFpwebStdOutWriter;
13+
TFpwebRequest = FpwebRequestImpl.TFpwebRequest;
14+
TFpwebRequestFactory = FpwebRequestFactoryImpl.TFpwebRequestFactory;
15+
TFpwebProcessor = FpwebProcessorImpl.TFpwebProcessor;
16+
{------------ End TFpHttpServer-related------------------}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
{------------ Begin TIdHTTPServer-related------------------}
10+
{$IFDEF USE_INDY}
11+
IndyAppServiceProviderImpl,
12+
IndyStdOutWriterImpl,
13+
IndyProcessorImpl,
14+
{$ENDIF}
15+
{------------ End TIdHTTPServer-related------------------}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
{------------ Begin TIdHTTPServer-related------------------}
10+
{$IFDEF USE_INDY}
11+
TIndyAppServiceProvider = IndyAppServiceProviderImpl.TINdyAppServiceProvider;
12+
TIndyStdOutWriter = IndyStdOutWriterImpl.TIndyStdOutWriter;
13+
TIndyProcessor = IndyProcessorImpl.TIndyProcessor;
14+
{$ENDIF}
15+
{------------ End TFpHttpServer-related------------------}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
{------------ Begin libmicrohttpd-related------------------}
10+
{$IFDEF LIBMICROHTTPD}
11+
MhdSvrConfigTypes,
12+
MhdAppServiceProviderImpl,
13+
MhdStdOutWriterImpl,
14+
MhdProcessorImpl,
15+
{$ENDIF}
16+
{------------ End libmicrohttpd-related------------------}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
{------------ Begin libmicrohttpd-related------------------}
10+
{$IFDEF LIBMICROHTTPD}
11+
TMhdSvrConfig = MhdSvrConfigTypes.TMhdSvrConfig;
12+
TMhdAppServiceProvider = MhdAppServiceProviderImpl.TMhdAppServiceProvider;
13+
TMhdStdOutWriter = MhdStdOutWriterImpl.TMhdStdOutWriter;
14+
TMhdProcessor = MhdProcessorImpl.TMhdProcessor;
15+
{$ENDIF}
16+
{------------ End libmicrohttpd-related------------------}

src/Includes/Libs/Implementations/Protocol/Http/implementations.inc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,8 @@
66
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
77
*}
88

9-
{------------ Begin libmicrohttpd-related------------------}
10-
{$IFDEF LIBMICROHTTPD}
11-
MhdSvrConfigTypes,
12-
MhdAppServiceProviderImpl,
13-
MhdStdOutWriterImpl,
14-
MhdProcessorImpl,
15-
{$ENDIF}
16-
{------------ End libmicrohttpd-related------------------}
9+
HttpSvrConfigTypes,
1710

18-
{------------ Begin TFpHttpServer-related------------------}
19-
FpwebSvrConfigTypes,
20-
FpwebAppServiceProviderImpl,
21-
FpwebStdOutWriterImpl,
22-
FpwebRequestImpl,
23-
FpwebRequestFactoryImpl,
24-
FpwebProcessorImpl,
25-
{------------ End TFpHttpServer-related------------------}
11+
{$INCLUDE Libmicrohttpd/implementations.inc}
12+
{$INCLUDE Fpweb/implementations.inc}
13+
{$INCLUDE Indy/implementations.inc}

src/Includes/Libs/Implementations/Protocol/Http/libs.aliases.inc

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,9 @@
66
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
77
*}
88

9-
{------------ Begin libmicrohttpd-related------------------}
10-
{$IFDEF LIBMICROHTTPD}
11-
TMhdSvrConfig = MhdSvrConfigTypes.TMhdSvrConfig;
12-
TMhdAppServiceProvider = MhdAppServiceProviderImpl.TMhdAppServiceProvider;
13-
TMhdStdOutWriter = MhdStdOutWriterImpl.TMhdStdOutWriter;
14-
TMhdProcessor = MhdProcessorImpl.TMhdProcessor;
15-
{$ENDIF}
16-
{------------ End libmicrohttpd-related------------------}
9+
THttpSvrConfig = HttpSvrConfigTypes.THttpSvrConfig;
10+
11+
{$INCLUDE Libmicrohttpd/libs.aliases.inc}
12+
{$INCLUDE Fpweb/libs.aliases.inc}
13+
{$INCLUDE Indy/libs.aliases.inc}
1714

18-
{------------ Begin TFpHttpServer-related------------------}
19-
TFpwebSvrConfig = FpwebSvrConfigTypes.TFpwebSvrConfig;
20-
TFpwebAppServiceProvider = FpwebAppServiceProviderImpl.TFpwebAppServiceProvider;
21-
TFpwebStdOutWriter = FpwebStdOutWriterImpl.TFpwebStdOutWriter;
22-
TFpwebRequest = FpwebRequestImpl.TFpwebRequest;
23-
TFpwebRequestFactory = FpwebRequestFactoryImpl.TFpwebRequestFactory;
24-
TFpwebProcessor = FpwebProcessorImpl.TFpwebProcessor;
25-
{------------ End TFpHttpServer-related------------------}

src/Libs/Protocol/Implementations/Http/Fpweb/Types/FpwebSvrConfigTypes.pas

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,13 @@ interface
1313
{$MODE OBJFPC}
1414
{$H+}
1515

16+
uses
17+
18+
HttpSvrConfigTypes;
19+
1620
type
1721

18-
TFpwebSvrConfig = record
19-
host : string;
20-
port : word;
21-
documentRoot : string;
22-
serverName : string;
23-
serverSoftware : string;
24-
serverSignature : string;
25-
serverAdmin : string;
26-
timeout : longword;
27-
//use IPv6
28-
useIPv6 : boolean;
29-
//use IPv6 = true and dualStack =true, support IPv4 and IPv6
30-
//use IPv6 = true and dualStack =false, IPv6 only
31-
dualStack : boolean;
32-
33-
//set to true if using https
34-
useTLS : boolean;
35-
//SSL certificate key file path
36-
tlsKey : string;
37-
//SSL certificate file path
38-
tlsCert : string;
39-
40-
threaded : boolean;
41-
threadPoolSize : integer;
42-
43-
mimeTypesFile : string;
44-
end;
22+
TFpwebSvrConfig = THttpSvrConfig;
4523

4624
implementation
4725

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{*!
2+
* Fano Web Framework (https://fanoframework.github.io)
3+
*
4+
* @link https://github.com/fanoframework/fano
5+
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
6+
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
7+
*}
8+
9+
unit IndyResponseAwareIntf;
10+
11+
interface
12+
13+
{$MODE OBJFPC}
14+
{$H+}
15+
16+
uses
17+
18+
IdBaseComponent,
19+
IdComponent,
20+
IdTCPServer,
21+
IdCustomHTTPServer;
22+
23+
type
24+
25+
(*!------------------------------------------------
26+
* interface for any class having maintain TIdHTTPServer
27+
* response instance
28+
*
29+
* @author Zamrony P. Juhara <zamronypj@yahoo.com>
30+
*-----------------------------------------------*)
31+
IIndyResponseAware = interface
32+
['{92EB633E-DAB9-43E4-8DF5-92C15EECEDAA}']
33+
34+
(*!------------------------------------------------
35+
* get TIdHTTPServer response connection
36+
*-----------------------------------------------
37+
* @return connection
38+
*-----------------------------------------------*)
39+
function getResponse() : TIdHTTPResponseInfo;
40+
41+
(*!------------------------------------------------
42+
* set TIdHTTPServer response connection
43+
*-----------------------------------------------*)
44+
procedure setResponse(aresponse: TIdHTTPResponseInfo);
45+
46+
property response: TIdHTTPResponseInfo read getResponse write setResponse;
47+
end;
48+
49+
implementation
50+
51+
end.

0 commit comments

Comments
 (0)