You are not logged in.
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
Offline
I do not understand the URI. There is no parameter, just a huge base 64 content.
This is far from a REST design. Perhaps DataSnap design - but pretty weird for a REST identifier.
Where does it break?
There is a limitation of parameter name maximum size at URI level, depending on the client browser used.
Large parameters should be supplied as POST body, not at URI level.
Offline
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
Last edited by mmbk (2016-02-03 13:14:27)
Offline
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
Offline
@mmbk
Check HTTP.SYS error log files (usually in this folder) C:\Windows\System32\LogFiles\HTTPERR\
Is some URL -related errors there? It is may me a windows (http.sys) level security to prevent a "long-url" type of attack
Last edited by mpv (2016-02-03 12:08:32)
Offline
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 '/'.
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
Any idea how to solve this?
Last edited by mmbk (2016-02-03 12:51:13)
Offline
Your URl is invalid from HTTP.SYS point of view. And http.sys driver drop such packages. See this article about HTTP.SYS error codes (your code is "URL" mean "A parse error occurred while processing a URL").
DataSnap server do not use HTTP.SYS, so it work.
You can either switch mORMot to socket server type, or edit a registry values to increase allowed URL size as described in this article
Last edited by mpv (2016-02-03 14:30:25)
Offline
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!
Last edited by mmbk (2016-02-03 15:47:33)
Offline