ftpsend - support for large streams
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@146 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
34
ftpsend.pas
34
ftpsend.pas
@@ -1,5 +1,5 @@
|
|||||||
{==============================================================================|
|
{==============================================================================|
|
||||||
| Project : Ararat Synapse | 003.005.004 |
|
| Project : Ararat Synapse | 004.000.000 |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Content: FTP client |
|
| Content: FTP client |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
@@ -92,7 +92,7 @@ type
|
|||||||
FFileName: String;
|
FFileName: String;
|
||||||
FDirectory: Boolean;
|
FDirectory: Boolean;
|
||||||
FReadable: Boolean;
|
FReadable: Boolean;
|
||||||
FFileSize: Longint;
|
FFileSize: int64;
|
||||||
FFileTime: TDateTime;
|
FFileTime: TDateTime;
|
||||||
FOriginalLine: string;
|
FOriginalLine: string;
|
||||||
FMask: string;
|
FMask: string;
|
||||||
@@ -107,7 +107,7 @@ type
|
|||||||
{:if you have rights to read}
|
{:if you have rights to read}
|
||||||
property Readable: Boolean read FReadable write FReadable;
|
property Readable: Boolean read FReadable write FReadable;
|
||||||
{:size of file in bytes}
|
{:size of file in bytes}
|
||||||
property FileSize: Longint read FFileSize write FFileSize;
|
property FileSize: int64 read FFileSize write FFileSize;
|
||||||
{:date and time of file. Local server timezone is used. Any timezone
|
{:date and time of file. Local server timezone is used. Any timezone
|
||||||
conversions was not done!}
|
conversions was not done!}
|
||||||
property FileTime: TDateTime read FFileTime write FFileTime;
|
property FileTime: TDateTime read FFileTime write FFileTime;
|
||||||
@@ -228,7 +228,7 @@ type
|
|||||||
FFullSSL: Boolean;
|
FFullSSL: Boolean;
|
||||||
function Auth(Mode: integer): Boolean; virtual;
|
function Auth(Mode: integer): Boolean; virtual;
|
||||||
function Connect: Boolean; virtual;
|
function Connect: Boolean; virtual;
|
||||||
function InternalStor(const Command: string; RestoreAt: integer): Boolean; virtual;
|
function InternalStor(const Command: string; RestoreAt: int64): Boolean; virtual;
|
||||||
function DataSocket: Boolean; virtual;
|
function DataSocket: Boolean; virtual;
|
||||||
function AcceptDataSocket: Boolean; virtual;
|
function AcceptDataSocket: Boolean; virtual;
|
||||||
procedure DoStatus(Response: Boolean; const Value: string); virtual;
|
procedure DoStatus(Response: Boolean; const Value: string); virtual;
|
||||||
@@ -308,7 +308,7 @@ type
|
|||||||
|
|
||||||
{:Return size of Filename file on FTP server. If command failed (i.e. not
|
{:Return size of Filename file on FTP server. If command failed (i.e. not
|
||||||
implemented), return -1.}
|
implemented), return -1.}
|
||||||
function FileSize(const FileName: string): integer; virtual;
|
function FileSize(const FileName: string): int64; virtual;
|
||||||
|
|
||||||
{:Send NOOP command to FTP server for preserve of disconnect by inactivity
|
{:Send NOOP command to FTP server for preserve of disconnect by inactivity
|
||||||
timeout.}
|
timeout.}
|
||||||
@@ -1040,10 +1040,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFTPSend.InternalStor(const Command: string; RestoreAt: integer): Boolean;
|
function TFTPSend.InternalStor(const Command: string; RestoreAt: int64): Boolean;
|
||||||
var
|
var
|
||||||
SendStream: TStream;
|
SendStream: TStream;
|
||||||
StorSize: integer;
|
StorSize: int64;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if FDirectFile then
|
if FDirectFile then
|
||||||
@@ -1087,7 +1087,7 @@ end;
|
|||||||
|
|
||||||
function TFTPSend.StoreFile(const FileName: string; Restore: Boolean): Boolean;
|
function TFTPSend.StoreFile(const FileName: string; Restore: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
RestoreAt: integer;
|
RestoreAt: int64;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if FileName = '' then
|
if FileName = '' then
|
||||||
@@ -1113,7 +1113,7 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
if FileName = '' then
|
if FileName = '' then
|
||||||
Exit;
|
Exit;
|
||||||
Result := InternalStor('APPE '+FileName, 0);
|
Result := InternalStor('APPE ' + FileName, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFTPSend.NoOp: Boolean;
|
function TFTPSend.NoOp: Boolean;
|
||||||
@@ -1134,7 +1134,7 @@ begin
|
|||||||
Result := (FTPCommand('DELE ' + FileName) div 100) = 2;
|
Result := (FTPCommand('DELE ' + FileName) div 100) = 2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFTPSend.FileSize(const FileName: string): integer;
|
function TFTPSend.FileSize(const FileName: string): int64;
|
||||||
var
|
var
|
||||||
s: string;
|
s: string;
|
||||||
begin
|
begin
|
||||||
@@ -1143,7 +1143,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
s := Trim(SeparateRight(ResultString, ' '));
|
s := Trim(SeparateRight(ResultString, ' '));
|
||||||
s := Trim(SeparateLeft(s, ' '));
|
s := Trim(SeparateLeft(s, ' '));
|
||||||
Result := StrToIntDef(s, -1);
|
{$IFDEF VER100}
|
||||||
|
Result := StrToIntDef(s, -1);
|
||||||
|
{$ELSE}
|
||||||
|
Result := StrToInt64Def(s, -1);
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1676,7 +1680,11 @@ begin
|
|||||||
x := StrToIntDef(BlockSize, 1)
|
x := StrToIntDef(BlockSize, 1)
|
||||||
else
|
else
|
||||||
x := 1;
|
x := 1;
|
||||||
|
{$IFDEF VER100}
|
||||||
Value.FileSize := x * StrToIntDef(Size, 0);
|
Value.FileSize := x * StrToIntDef(Size, 0);
|
||||||
|
{$ELSE}
|
||||||
|
Value.FileSize := x * StrToInt64Def(Size, 0);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
DecodeDate(Date,myear,mmonth,mday);
|
DecodeDate(Date,myear,mmonth,mday);
|
||||||
mhours := 0;
|
mhours := 0;
|
||||||
@@ -1767,7 +1775,11 @@ begin
|
|||||||
'r':
|
'r':
|
||||||
flr.Readable := true;
|
flr.Readable := true;
|
||||||
's':
|
's':
|
||||||
|
{$IFDEF VER100}
|
||||||
flr.FileSize := StrToIntDef(Copy(s, 2, Length(s) - 1), 0);
|
flr.FileSize := StrToIntDef(Copy(s, 2, Length(s) - 1), 0);
|
||||||
|
{$ELSE}
|
||||||
|
flr.FileSize := StrToInt64Def(Copy(s, 2, Length(s) - 1), 0);
|
||||||
|
{$ENDIF}
|
||||||
'm':
|
'm':
|
||||||
flr.FileTime := (StrToIntDef(Copy(s, 2, Length(s) - 1), 0) / 86400)
|
flr.FileTime := (StrToIntDef(Copy(s, 2, Length(s) - 1), 0) / 86400)
|
||||||
+ 25569;
|
+ 25569;
|
||||||
|
Reference in New Issue
Block a user