7
uses Classes,pkgdownload;
10
TSynapseDownloader = Class(TBaseDownloader)
12
Procedure FTPDownload(Const URL : String; Dest : TStream); override;
13
Procedure HTTPDownload(Const URL : String; Dest : TStream); override;
18
uses sysutils,uriparser,httpsend,ftpsend,pkgmessages;
20
Procedure TSynapseDownloader.FTPDownload(Const URL : String; Dest : TStream);
28
// Download in temporary file.
29
FN:=GetTempFileName();
32
with TFTPSend.Create do
34
if URI.UserName <> '' then
36
Username := URI.UserName;
37
Password := URI.Password;
39
TargetHost := URI.Host;
41
TargetPort := IntToStr(URI.Port);
43
Error(SErrLoginFailed);
46
If (URI.Path<>'') then
47
if not ChangeWorkingDir(URI.Path) then
48
Error(SErrCWDFailed,[URI.PATH]);
50
If Not RetrieveFile(URI.Document, False) then
51
Error(SErrGETFailed,[URI.Document]);
56
F:=TFileStream.Create(FN,fmOpenRead);
63
// Delete temporary file.
64
If FileExists(FN) then
69
Procedure TSynapseDownloader.HTTPDownload(Const URL : String; Dest : TStream);
72
If Not HttpGetBinary(URL,Dest) then
73
Error(SErrHTTPGetFailed);
b'\\ No newline at end of file'