#1 mORMot 1 » Problem using 'Accept' header parameter in TWinHttp » 2017-02-05 22:10:47

mmbk
Replies: 0

The TWinHttp class is putting the string '* / *,' in front of the value of the 'Accept' parameter in header section.

I only put 'Accept: application / json' in aHeader parameter of TWinHttp.Get, but my server receives: 'Accept: * / *, application / json'

I'm using TWinHttp to talk to AWS and this parameter is part of 'AWS Signature Version 4', with this difference my Autorization is created wrong

#2 mORMot 1 » wrong value in the TSQLRecord.FillCurrentRow property » 2016-03-22 17:34:02

mmbk
Replies: 1

I have this code that fills a StringGrid with the list of users

u := TSQLAuthUser.CreateAndFillPrepare(Controlador.Database, TInt64DynArray(ids));
  stringgrid1.RowCount := u.FillTable.RowCount;

  while u.FillOne do
  begin                             
    sgUsuarios.Cells[0, u.FillCurrentRow - 2] := IntToString(u.id);
    sgUsuarios.Cells[1, u.FillCurrentRow - 2] := u.LogonName;
  end;


This code works well, but I think I should use "u.FillCurrentRow - 1".

The constructor TSQLAuthUser.CreateAndFillPrepare set FillCurrentRow to 1, but when I call u.FillOne the FillCurrentRow is incremented.

source code:

function TSQLRecord.FillOne: boolean;
begin
  if (self=nil) or (fFill=nil) or (fFill.Table=nil) or
     (fFill.Table.fRowCount=0) or // also check if FillTable is emtpy
     (cardinal(fFill.FillCurrentRow)>cardinal(fFill.Table.fRowCount)) then
    result := false else begin
    FillRow(fFill.FillCurrentRow);
    inc(fFill.fFillCurrentRow);
    result := true;
  end;
end;

Is that correct?

#3 Re: mORMot 1 » THttpApiServer Error "HTTP Error 400. The request URL is invalid." » 2016-02-03 15:26:57

Thank you all for your time.

mpv thanks for the help, I chose to change the Windows Registry (even knowing the risks involved) and it worked! Thank you!

ps.: I changed my server to THttpServer (changing two command lines) as mpv mentioned and it worked too!

I love this framework!

Thank you again!

#4 Re: mORMot 1 » THttpApiServer Error "HTTP Error 400. The request URL is invalid." » 2016-02-03 12:42:07

esmondb wrote:

Normally about 2000 chars in a URL is fine. Not sure why you have the 260 char limit.
Only solution I can think of is to find a way to shorten the URL

esmondb It is not a limitation of the size of the URL , but the text between '/'.


mpv wrote:

Check HTTP.SYS error log files (usually in this folder)

mpv I check it and find this:

"2016-02-03 12:15:50 ::1%0 57776 ::1%0 888 HTTP/1.1 GET /root/NoteFile/MCAxMDAgICAgICAgICAgICAgICAgIDY2OSCdAgMDAFgSGTB3d3d3d3d3d3d3d3d3d3d3d3d3dwkIBQQCOzk3NTQyMC4uLXd3DAsJBwUCOzk2NDMyMC4tLXd3Dw0LCAUCADg2N1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa333333333333333333333333333333333333333333332222222222222222222222222222222222222222222224aaaaaaaaaaa/blob 400 - URL -"

It was a test I did in the Samples 26 " mORMot\SQLite3\Samples\26 - RESTful ORM \ RESTserver.dproj ". I tried to make a GET with an ID with more than 260 char and I had the same problem. But if I use a DataSnap server or a Ninja IO server, the GET command works.

Printscreen from IO Ninja accept this command
IO Ninja printscreen


Any idea how to solve this?

#5 Re: mORMot 1 » THttpApiServer Error "HTTP Error 400. The request URL is invalid." » 2016-02-03 10:53:42

Hi ab,

Thank you for reply!

It's should be datasnap design. The problem is the number of char after the last '/', is what I called 'parameter' ('MCAxMDAgICAg ... aaaaa').
If it have less than 260 char everything works fine. If I send more than 260 char the function

Err: = Http.ReceiveHttpRequest (fReqQueue, ReqID, 0, Req ^, Length (ReqBuf), bytesRead);

inside

procedure THttpApiServer.Execute;

is not returned and the error ('HTTP Error 400. The request URL is invalid.') is generated.

Any idea how to solve this?

thank you

#6 mORMot 1 » THttpApiServer Error "HTTP Error 400. The request URL is invalid." » 2016-02-02 18:12:18

mmbk
Replies: 7

Hi,

I have a Http Server (THttpApiServer) that works great. For compatibility reasons I had to make it accept REST calls. These calls have large parameters, but every time a parameter exceeds 260 strings gives this error. How can I increase this limit?

Call example:

http://localhost:8080/datasnap/rest/metodos/cadastraTemplateDigital/MCAxMDAgICAgICAgICAgICAgICAgIDY2OSCdAgMDAFgSGTB3d3d3d3d3d3d3d3d3d3d3d3d3dwkIBQQCOzk3NTQyMC4uLXd3DAsJBwUCOzk2NDMyMC4tLXd3Dw0LCAUCADg2N1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa333333333333333333333333333333333333333333332222222222222222222222222222222222222222222224aaaaaaaaaaaaaaaa

Thank you

#7 Re: mORMot 1 » timeout parameters don't work in THttpRequest » 2015-07-24 18:08:41

Ok ab! Sorry about this!

Thank you for replay and congratulations on your framework!

#8 mORMot 1 » timeout parameters don't work in THttpRequest » 2015-07-23 22:07:49

mmbk
Replies: 2

Hi, I'm trying this code:

  winHTTP := TWinHTTP.Create('localhost', '888', false, '', '', 60000, 70000, 130000);
  try
      Result := winHTTP.Post(StringToUTF8(link), StringToUTF8(data));
  finally
    winHTTP.Free;
  end;
but de post method return before my timeout, it always use the default constant

I think TWinHTTP.Create don't store any timeout parameters
The "winHTTP.Post" method call "THttpRequest.InternalREST" that call "self.Create(Server,Port,Https,'','')" using the default timeout parameters (const).

Can any one help me on this?

Thank you (sorry my english)

#9 Re: mORMot 1 » how to set client connection timeout? » 2015-07-20 19:41:48

Hi, I'm have the same problem with this code:

  winHTTP := TWinHTTP.Create('localhost', '888', false, '', '', 60000, 70000, 130000);
  try
      Result := winHTTP.Post(StringToUTF8(link), StringToUTF8(data));
  finally
    winHTTP.Free;
  end;

I think TWinHTTP.Create don't store any timeout parameters

The "winHTTP.Post" method call "THttpRequest.InternalREST" that call "self.Create(Server,Port,Https,'','')" using the default timeout parameters.

Can any one help me on this?

Thank you (sorry my english)
"

Board footer

Powered by FluxBB