#2 SyNode » Update of Synode » 2020-03-29 19:45:44

mapes
Replies: 2

Hi,
do you can update Synode units
to compile with latest version of mORMot?

Thank you

#3 mORMot 1 » JSONEncode in Delphi » 2020-03-29 19:40:02

mapes
Replies: 1

Hi,

do you can try r := JSONEncode(['t','test "" again ""']);
Result: {"t":"text \"" again ""\" again \""\""}

Fast Patch (inserted line // mapes):

procedure TTextWriter.AddJSONEscapeW(P: PWord; Len: PtrInt);
var i,c,s: PtrInt;
    esc: byte;
begin
  if P=nil then
    exit;
  if Len=0 then
    Len := MaxInt;
  i := 0;
  while i<Len do begin
    s := i;
    repeat
      c := PWordArray(P)[i];
      if (c<=127) and (JSON_ESCAPE[c]<>0) then
        break;
      inc(i);
    until i>=Len;
    if i <> s then //  mapes
    AddNoJSONEscapeW(@PWordArray(P)[s],i-s);
    if i>=Len then
      exit;
    c := PWordArray(P)[i];
    if c=0 then
      exit;
    esc := JSON_ESCAPE[c];
    if esc=1 then // #0
      exit else
    if esc=2 then begin // characters below ' ', #7 e.g. -> \u0007
      AddShort('\u00');
      AddByteToHex(c);
    end else
      Add('\',AnsiChar(esc)); // escaped as \ + b,t,n,f,r,\,"
    inc(i);
  end;
end;

#5 Re: mORMot 1 » MultiPartFormDataEncode » 2019-04-20 18:07:13

Of course I have first tried this solution.

in MultiPartFormDataDecode

you have this line:

part.Content := copy(Body,i,j-i-2); // -2 to ignore latest #13#10

So in this case changing one line feed from #10 to #13#10 seems like right answer :-)

#6 mORMot 1 » MultiPartFormDataEncode » 2019-04-20 05:35:07

mapes
Replies: 4

Hi,

crc := 'A8FBDC27';
MultiPartFormDataAddField('crc',crc,fMultipart);

after decode on server side
crc = 'A8FBDC2'

I think problem is in MultiPartFormDataEncode:

W.Add('--%'#13#10'Content-Disposition: form-data; name="%"'#13#10+
    'Content-Type: %'#13#10#13#10'%'#10'--%'#13#10,
     [bound,Name,ContentType,Content,bound]) else begin

should be

W.Add('--%'#13#10'Content-Disposition: form-data; name="%"'#13#10+
    'Content-Type: %'#13#10#13#10'%'#13#10'--%'#13#10,
     [bound,Name,ContentType,Content,bound]) else begin

#7 Re: mORMot 1 » TJWTAbstract.Verify » 2019-03-26 07:18:24

Ok.

But if local time used for TJWTAbstract.Compute > server time,

j.Verify = jwtInvalidIssuedAt.

Is there a way to compute from Server TimeStamp ?

#8 mORMot 1 » TJWTAbstract.Verify » 2019-03-25 13:31:51

mapes
Replies: 2

Hi,

j := TJWTS3512.Create(JWTLoginSecret, JWTIterationCount, [jrcIssuer, jrcSubject, jrcExpirationTime,jrcIssuedAt,jrcAudience, jrcJWTID], [], 60);
j.Verify(data, jc,[jrcIssuedAt,jrcAudience]);

if data contain IssuedAt claim, gets verified even if is in  Excluded claims.

Is it expected behaviour?

#9 mORMot 1 » TCurlHTTP » 2019-02-18 11:14:25

mapes
Replies: 8

Hi,

in SynNodeBinding_HTTPClient
is used TWinHTTP for Windows and TCurlHTTP for Linux

Is it problem to add in
TCurlHTTP.InternalSendRequest
curl.easy_setopt(fHandle,coFollowLocation,1)

to achieve the same behavior?

Because under Windows the result is 200 (auto redirection), under Linux 302 and Location: .... in headers

in case the requested site uses internal redirection

#10 mORMot 1 » TDynArray sort AV » 2019-01-03 22:33:10

mapes
Replies: 1

Hi,

If I add empty string to array,
sorting the array causes AV.

rev 1.18.4885

  procedure foo;
  var Ar: TStringDynArray;
      s: String;
      AK: TDynArray;
  begin
    AK.Init(TypeInfo(TStringDynArray),Ar);
    s := 'a';
    AK.Add(s);
    s := '';
    AK.Add(s);
    AK.Sort(SortDynArrayString);
  end;

#11 mORMot 1 » CreateMissingTables question » 2018-07-06 07:00:49

mapes
Replies: 2

Hi,

I'm using TSQLRestServerDb with Postgresql

  fServer := TSQLRestServerDB.Create(fModel);
  fServer.CreateMissingTables(0,INITIALIZETABLE_NOINDEX);

Is there a way to know, what tables were actually created on remote DB with CreateMissingTables ?

Even If I use INITIALIZETABLE_NOINDEX, table on remote DB is always created with Primary ID index. Is this expected behavior?

#12 Re: SyNode » Beta release of SyNode - ES6 JavaScript + NPM modules » 2018-04-22 09:39:21

Hi,

under linux fs.readdirSync is not reading Directories.

in fs_readDir

{$IFDEF MSWINDOWS}
if FindFirst(Dir + '*.*', searchAttr, F) = 0 then begin
{$ELSE}
if FindFirst(Dir + '*', searchAttr, F) = 0 then begin
{$ENDIF}

or FindFirst (Dir + '*',searchAttr,F) for both OS solves the problem.

#13 Re: SyNode » SyNode Delphi XE3 AV » 2017-11-02 22:16:25

I can have only Delphi 7, so FPC for windows is the only way for me I suppose.
I really don't know why, when using Properties instead of Parameter there is allways nil.

And FPC for linux is what I'm looking forward.

#14 SyNode » SyNode Delphi XE3 AV » 2017-11-01 20:05:06

mapes
Replies: 3

Hi,

I have tried to compile Example 2 in Delphi XE3, but got AV.

The problem is related to

https://synopse.info/forum/viewtopic.php?id=1733

To make it work, following functions must be used instead of Properties:

SpiderMonkey 45:

JSRuntime 
    function GetPrivate: Pointer;
    procedure SetPrivate(const Value: Pointer);
    function GetOptions: PJSRuntimeOptions;
    function GetGCParameter(key: JSGCParamKey): uint32;
    procedure SetGCParameter(key: JSGCParamKey; const Value: uint32);
    function GetErrorReporter: JSErrorReporter;
    procedure SetErrorReporter(er: JSErrorReporter);
    function GetInterruptCallback: JSInterruptCallback;
    procedure SetInterruptCallback(callback: JSInterruptCallback);
 
JSRuntimeOptions
    function getOptions(const Index: Integer): Boolean;
    procedure setOptions(const Index: Integer; const Value: Boolean);

SpiderMonkey 52:

  JSContext
  function GetPrivate: Pointer; {$ifdef HASINLINE}inline;{$endif}
  procedure SetPrivate(const Value: Pointer);   
 
  JSContextOptions
  function getOptions(const Index: Integer): Boolean;
  procedure setOptions(const Index: Integer; const Value: Boolean);

For some reason  SM52 fRt.GCParameter[] works, in SM45 need fRt.SetGCParameter

#16 Re: Source Code repository » SynCommons: TDynArray and Record compare/load/save using fast RTTI » 2016-10-30 19:33:35

Hi,
I have tried example from page 1, just added 5 lines of code

TMyMap = record
    Key: string;
    Value: array of string;
  end;
  TMyMapDynArray = array of TMyMap;

var
  Map: TMyMap;
  Maps: TMyMapDynArray;
  MapW: TDynArrayHashed;
  key: string;
  i: integer;
begin
  MapW.Init(TypeInfo(TMyMapDynArray),Maps);
  Map.Key := 'Some key';
  SetLength(Map.Value,2);
  Map.Value[0] := 'One';
  Map.Value[1] := 'Two';
  // from here added code
  MapW.Add(map);
  Map.Key := 'Some key 2';
  Map.Value[0] := 'Five';
  Map.Value[1] := 'Three';
  MapW.Add(map);

I end up with result like this: (('Some key', ('Five', 'Three')), ('Some key 2', ('Five', 'Three'))).
For simple variables TDynArray works well, but for arrays in record has array always value of last added record.
Or am I doing something wrong?

Board footer

Powered by FluxBB