Debian Codegraph @

src/files/castledownload.pas

raw
1 {
2 Copyright 2013-2024 Michalis Kamburelis.
3
4 This file is part of "Castle Game Engine".
5
6 "Castle Game Engine" is free software; see the file COPYING.txt,
7 included in this distribution, for details about the copyright.
8
9 "Castle Game Engine" is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 ----------------------------------------------------------------------------
14 }
15
16 { Read and write stream contents from URLs. }
17 unit CastleDownload;
18
19 {$I castleconf.inc}
20
21 interface
22
23 uses SysUtils, Classes,
24 CastleVectors;
25
26 {$define read_interface}
27 {$I castledownload_register.inc}
28 {$I castledownload_synchronous.inc}
29 {$I castledownload_asynchronous.inc}
30 {$I castledownload_save.inc}
31 {$I castledownload_text.inc}
32 {$I castledownload_strings_helper.inc}
33 {$I castledownload_mime.inc}
34 {$I castledownload_utils.inc}
35 {$undef read_interface}
36
37 implementation
38
39 { What to use with Delphi to download http(s) URLs?
40
41 - Define CASTLE_DELPHI_NET_HTTP_CLIENT to use System.Net.HttpClient
42 and TNetHTTPClient with Delphi.
43
44 Doesn't require any external DLLs on Windows.
45
46 But it is very slow to download larger files on Windows.
47
48 - Do not define CASTLE_DELPHI_NET_HTTP_CLIENT to use IdHttp, Indy.
49 Requires OpenSSL DLLs.
50
51 Has a big problem on Linux:
52 It seems Indy requires really old OpenSSL library version (1.0 ?),
53 not available in latest Ubuntu. And it's not even 1.1,
54 so https://gist.github.com/joulgs/c8a85bb462f48ffc2044dd878ecaa786 will not help.
55 The PR to support newer OpenSSL was never merged https://github.com/IndySockets/Indy/pull/299 .
56 }
57 {$if defined(DELPHI) and defined(LINUX)}
58 {$define CASTLE_DELPHI_NET_HTTP_CLIENT}
59 {$endif}
60
61 uses URIParser, Math, Generics.Collections,
62 {$define read_implementation_uses}
63 {$I castledownload_url_http_android.inc}
64 {$I castledownload_url_http_fphttpclient.inc}
65 {$I castledownload_url_http_delphi_net.inc}
66 {$I castledownload_url_http_indy.inc}
67 {$undef read_implementation_uses}
68 {$if defined(VER3_2) and defined(DARWIN) and not defined(CASTLE_IOS)}
69 { for ESocketError } SSockets,
70 {$endif}
71 CastleUriUtils, CastleUtils, CastleLog, CastleInternalZStream,
72 CastleClassUtils, CastleInternalDataUri, CastleStringUtils,
73 CastleApplicationProperties, CastleFilesUtils;
74
75 {$define read_implementation}
76 {$I castledownload_internal_utils.inc}
77
78 // handlers of various URL protocols
79 {$I castledownload_url_castleandroidassets.inc}
80 {$I castledownload_url_castlescript.inc}
81 {$I castledownload_url_compiled.inc}
82 {$I castledownload_url_data.inc}
83 {$I castledownload_url_ecmascript.inc}
84 {$I castledownload_url_file.inc}
85 {$I castledownload_url_http_android.inc}
86 {$I castledownload_url_http_fphttpclient.inc}
87 {$I castledownload_url_http_delphi_net.inc}
88 {$I castledownload_url_http_indy.inc}
89
90 {$I castledownload_register.inc}
91 {$I castledownload_synchronous.inc}
92 {$I castledownload_asynchronous.inc}
93 {$I castledownload_save.inc}
94 {$I castledownload_text.inc}
95 {$I castledownload_strings_helper.inc}
96 {$I castledownload_mime.inc}
97 {$I castledownload_utils.inc}
98
99 initialization
100 finalization
101 FreeAndNil(FRegisteredProtocols);
102 end.