|
@@ -6,6 +6,7 @@ interface
|
|
|
|
|
|
uses
|
|
uses
|
|
SysUtils, Classes,
|
|
SysUtils, Classes,
|
|
|
|
+ uriparser,
|
|
lnet, lftp, lhttp, pkgdownload,pkgoptions, fprepos;
|
|
lnet, lftp, lhttp, pkgdownload,pkgoptions, fprepos;
|
|
|
|
|
|
Type
|
|
Type
|
|
@@ -18,6 +19,7 @@ Type
|
|
FFTP: TLFTPClient;
|
|
FFTP: TLFTPClient;
|
|
FHTTP: TLHTTPClient;
|
|
FHTTP: TLHTTPClient;
|
|
FOutStream: TStream;
|
|
FOutStream: TStream;
|
|
|
|
+ URI: TURI;
|
|
protected
|
|
protected
|
|
// callbacks
|
|
// callbacks
|
|
function OnHttpClientInput(ASocket: TLHTTPClientSocket; ABuffer: pchar;
|
|
function OnHttpClientInput(ASocket: TLHTTPClientSocket; ABuffer: pchar;
|
|
@@ -39,7 +41,6 @@ Type
|
|
implementation
|
|
implementation
|
|
|
|
|
|
uses
|
|
uses
|
|
- uriparser,
|
|
|
|
pkgglobals,
|
|
pkgglobals,
|
|
pkgmessages;
|
|
pkgmessages;
|
|
|
|
|
|
@@ -95,13 +96,11 @@ procedure TLNetDownloader.OnFTPFailure(aSocket: TLSocket;
|
|
const aStatus: TLFTPStatus);
|
|
const aStatus: TLFTPStatus);
|
|
begin
|
|
begin
|
|
FFTP.Disconnect;
|
|
FFTP.Disconnect;
|
|
- Error(SErrDownloadFailed,['FTP','']);
|
|
|
|
|
|
+ Error(SErrDownloadFailed,['FTP',EncodeURI(URI),'']);
|
|
FQuit:=True;
|
|
FQuit:=True;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TLNetDownloader.FTPDownload(const URL: String; Dest: TStream);
|
|
procedure TLNetDownloader.FTPDownload(const URL: String; Dest: TStream);
|
|
-var
|
|
|
|
- URI: TURI;
|
|
|
|
begin
|
|
begin
|
|
FOutStream:=Dest;
|
|
FOutStream:=Dest;
|
|
Try
|
|
Try
|
|
@@ -128,8 +127,6 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TLNetDownloader.HTTPDownload(const URL: String; Dest: TStream);
|
|
procedure TLNetDownloader.HTTPDownload(const URL: String; Dest: TStream);
|
|
-var
|
|
|
|
- URI: TURI;
|
|
|
|
begin
|
|
begin
|
|
FOutStream:=Dest;
|
|
FOutStream:=Dest;
|
|
Try
|
|
Try
|
|
@@ -149,7 +146,7 @@ begin
|
|
while not FQuit do
|
|
while not FQuit do
|
|
FHTTP.CallAction;
|
|
FHTTP.CallAction;
|
|
if FHTTP.Response.Status<>HSOK then
|
|
if FHTTP.Response.Status<>HSOK then
|
|
- Error(SErrDownloadFailed,['HTTP',FHTTP.Response.Reason]);
|
|
|
|
|
|
+ Error(SErrDownloadFailed,['HTTP',EncodeURI(URI),FHTTP.Response.Reason]);
|
|
Finally
|
|
Finally
|
|
FOutStream:=nil; // to be sure
|
|
FOutStream:=nil; // to be sure
|
|
end;
|
|
end;
|