You are not logged in.
Nope. The result is 301.
So you need to set
h.RedirectMax := 10;
before the request to enable redirection.
Then we got a 200 response, but with no chunked encoding flag, nor content-length.
https://www.rfc-editor.org/rfc/rfc7230#section-3.3.3 states it should read all data until the server closes the connection.
This is a pretty inefficient way of handling the content size, and void the whole HTTP/1.1 interrest - this server is awfully coded for sure, and react as a HTTP/1.0 server.Previous version was only reading till the connection close with HTTP/1.0 - now I have enabled it for HTTP/1.1 also.
See https://github.com/synopse/mORMot2/commit/ddb7c8d4
@ab you probably remember the above case.
it was impossible to get correct encoding with an http call when using:
var s:RawByteString; op:THttpClientSocket;
op.Request(url,'GET',_KeepAlive,headers,'','',true,nil{,ContentStream});
s:=op.content;
so I decided to use the call with a stream:
THttpClientSocket.Request(url,'GET',_KeepAlive,headers,'','',true,nil,ContentStream);
I noticed that the above fix does not work with stream parameter and the stream returns empty.
Is it possible also to declare the default encoding for received content if an oracle web server like the one I am using does not return an encoding flag?
Thank you in advance
Last edited by dcoun (2023-07-13 12:07:43)
Offline
forget it.....
It was my fault.
No need for something like that
Last edited by dcoun (2023-07-13 12:13:49)
Offline
I can probably use a TRawBytesStream to get a stream and not bothering you.... I will try it
Offline
it does not work. I think the problem is in mormot.net.client, line 1616
if ctxt.OutStream <> nil then
begin
if (Http.ContentLength > 0) and
(ctxt.Status in [HTTP_SUCCESS, HTTP_PARTIALCONTENT]) then
begin
if ctxt.OutStream.InheritsFrom(TStreamRedirect) then
TStreamRedirect(ctxt.OutStream).ExpectedSize :=
fRangeStart + Http.ContentLength;
GetBody(ctxt.OutStream)
end;
end
else
GetBody(nil);
if stream is defined and header content-length does not exist, it will never call GetBody
Offline
I am experiencing also corrupted result content from mormot2's http client, if non-latin characters are included in the returned text.
Probably it happens with the http calls that do not return content-length, but I did not have such problems with WINET and if using directly the curl library
Offline
Delphi 11.3
Win11
Offline
One more hint using WININET (again now.....) in THttpRequest.Request:
If you include Content-type header in InHeader parameter it is included in the request. If InDataType is set, content-type there is not recognized by my Oracle solution web server I have to deal with
Offline