Skip to content

Commit

Permalink
Sync with 2.4 beta 6 - v308
Browse files Browse the repository at this point in the history
Added https support
  • Loading branch information
drapid committed May 27, 2020
1 parent 6a6480c commit 55d2bb2
Show file tree
Hide file tree
Showing 18 changed files with 1,030 additions and 869 deletions.
2 changes: 2 additions & 0 deletions HFS302_rus.utflng
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
desc=Русский
[Open in browser]
Открыть в браузере
[Top speed]
Макс. скорость
[Menu]
Меню
[Self Test]
Expand Down
6 changes: 3 additions & 3 deletions classesLib.pas
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ Tsession = class
destructor Destroy; override;
procedure keepAlive();
procedure setTTL(t:Tdatetime);
property v[k: TSessionId]: String read getVar write setVar;
property v[k: TSessionId]: String read getVar write setVar; default;
end;

Tsessions = class
fS: Tdictionary<TSessionId,Tsession>;
fS: TDictionary<TSessionId,Tsession>;
public
constructor create;
destructor Destroy; override;
Expand All @@ -201,7 +201,7 @@ Tsessions = class
function noSession(sId: TSessionId): Boolean;
procedure keepAlive(sId: TSessionId);
procedure checkExpired;
property ss[sId: TSessionId]: Tsession read getSession;
property ss[sId: TSessionId]: Tsession read getSession; default;
end;

ThashFunc = function(s:string):string;
Expand Down
4 changes: 2 additions & 2 deletions compressHFS.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@copy hfs.exe "HFS303_RD.exe"
upx.exe -9 --lzma "HFS303_RD.exe"
@copy hfs.exe "HFS308_RD.exe"
upx.exe -9 --lzma "HFS308_RD.exe"
19 changes: 10 additions & 9 deletions fileLib.pas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unit FileLib;
unit fileLib;

interface

Expand Down Expand Up @@ -1395,28 +1395,29 @@ function Tfile.getRecursiveFileMask():string;

function Tfile.getAccountsFor(action:TfileAction; specialUsernames:boolean=FALSE; outInherited:Pboolean=NIL):TstringDynArray;
var
i: integer;
f: Tfile;
s: string;
begin
result:=NIL;
f:=self;
if assigned(outInherited) then outInherited^:=FALSE;
while assigned(f) do
begin
for i:=0 to length(f.accounts[action])-1 do
for var s in f.accounts[action] do
begin
s:=f.accounts[action][i];
if (s = '')
or (action = FA_UPLOAD) and not f.isRealFolder() then continue; // we must ignore this setting
or (action = FA_UPLOAD) and not f.isRealFolder() then // we must ignore this setting
continue;

if specialUsernames and (s[1] = '@')
or accountExists(s, specialUsernames) then // we admit groups only if specialUsernames are admitted too
addString(s, result);
end;
if (action = FA_ACCESS) and (f.user > '') then addString(f.user, result);
if assigned(result) then exit;
if assigned(outInherited) then outInherited^:=TRUE;
if (action = FA_ACCESS) and (f.user > '') then
addString(f.user, result);
if assigned(result) then
exit;
if assigned(outInherited) then
outInherited^:=TRUE;
f:=f.parent;
end;
end; // getAccountsFor
Expand Down
6 changes: 3 additions & 3 deletions hfsGlobal.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ interface

const
{$I RnQBuiltTime.inc}
VERSION = '2.4 beta2 RD';
VERSION_BUILD = '305';
VERSION = '2.4 beta6 RD';
VERSION_BUILD = '308';
VERSION_STABLE = {$IFDEF STABLE } TRUE {$ELSE} FALSE {$ENDIF};
CURRENT_VFS_FORMAT :integer = 1;
CRLF = #13#10;
Expand Down Expand Up @@ -134,7 +134,7 @@ interface

type
TcharSetA = TSysCharSet; //set of char;
TcharSetW = set of Char; //set of char;
TcharSetW = set of Char deprecated 'Holds Char values in the ordinal range of 0..255 only.'; //set of char;

// Pboolean = ^boolean;

Expand Down
13 changes: 7 additions & 6 deletions hslib.pas
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ ThttpConn = class
eventData: RawByteString;
ignoreSpeedLimit: boolean;
limiters: TobjectList; // every connection can be bound to a number of TspeedLimiter
constructor create(server:ThttpSrv);
constructor create(server:ThttpSrv; acceptingSock:Twsocket);
destructor Destroy; override;
procedure disconnect();
// procedure addHeader(s:string; overwrite:boolean=TRUE); OverLoad; // append an additional header line
Expand Down Expand Up @@ -355,8 +355,6 @@ implementation
AnsiClasses, RDUtils, Base64;

const
CRLF = #13#10;
CRLFA = RawByteString(#13#10);
MAX_REQUEST_LENGTH = 64*1024;
MAX_INPUT_BUFFER_LENGTH = 256*1024;
// used as body content when the user did not specify any
Expand Down Expand Up @@ -772,7 +770,7 @@ procedure ThttpSrv.stop();
procedure ThttpSrv.connected(Sender: TObject; Error: Word);
begin
if error=0 then
ThttpConn.create(self)
ThttpConn.create(self, sender as Twsocket)
end;

procedure ThttpSrv.disconnected(Sender: TObject; Error: Word);
Expand Down Expand Up @@ -1016,13 +1014,16 @@ procedure ThttpSrv.bgexception(Sender: TObject; E: Exception; var CanClose: Bool

////////// CLIENT

constructor ThttpConn.create(server:ThttpSrv);
constructor ThttpConn.create(server:ThttpSrv; acceptingSock:Twsocket);
var
i: integer;
begin
// init socket
sock:=Twsocket.create(NIL);
sock.Dup(server.sock.Accept);
if acceptingSock <> NIL then
sock.Dup(acceptingSock.accept())
else
sock.Dup(server.sock.accept());
sock.OnDataAvailable:=dataavailable;
sock.OnSessionClosed:=disconnected;
sock.onSendData:=senddata;
Expand Down
Loading

0 comments on commit 55d2bb2

Please sign in to comment.