I've finally finished to rework all my codes, so it works both with old Indy OpenSSL 1.0.2
and latest ICS 9.1 (OpenSSL 3.2) by setting a simple checkbox (UseSSL3?)
But when I test it, it gives odd results, because it takes 3x so much time to download a simple XML with ICS now.
Old Indy download time = 560 - 570ms
New ICS download time = 1560-1580ms
I have tested it many many times, same results.
- Both components running in background thread.
- BasicAuth (username + password) is used.
- Indy component is getting created each time before download. But ICS (+SSL initialization) is done only once before thread start.
The code I use is very simple:
function Get_with_SSL3(const url: string; SslHttpCli3: TSslHttpCli; var Data:TMemoryStream; var error: string; timeOut: integer): Boolean;
var
size: Int64;
begin
Result := False;
if Data = nil then
Data := TMemoryStream.Create;
SslHttpCli3.URL := url;
SslHttpCli3.Timeout := timeOut;
try
try
SslHttpCli3.Get;
except on E:Exception do // 400
error := E.Message;
end;
finally
Result := (SslHttpCli3.StatusCode = 200) or (SslHttpCli3.StatusCode = 400);
size := 0;
try
if Assigned(SslHttpCli3.RcvdStream) then begin
SslHttpCli3.RcvdStream.Seek(0, soFromBeginning);
size := SslHttpCli3.RcvdStream.Size;
end;
if size > 0 then begin
Data.Clear;
Data.LoadFromStream( SslHttpCli3.RcvdStream );
end
else
error := 'ERROR! 0 byte answer. ' + error;
except on E: Exception do
hiba := '! Stream read error: ' + CRLF + E.Message;
end;
if Assigned(SslHttpCli3.SendStream) then SslHttpCli3.SendStream.Size := 0;
if Assigned(SslHttpCli3.RcvdStream) then SslHttpCli3.RcvdStream.Size := 0;
end;
end;
Is this "normal" ?
I've finally finished to rework all my codes, so it works both with old Indy OpenSSL 1.0.2
and latest ICS 9.1 (OpenSSL 3.2) by setting a simple checkbox (UseSSL3?)
But when I test it, it gives odd results, because it takes 3x so much time to download a simple XML with ICS now.
Old Indy download time = 560 - 570ms
New ICS download time = 1560-1580ms
I have tested it many many times, same results.
- Both components running in background thread.
- BasicAuth (username + password) is used.
- Indy component is getting created each time before download. But ICS (+SSL initialization) is done only once before thread start.
The code I use is very simple:
function Get_with_SSL3(const url: string; SslHttpCli3: TSslHttpCli; var Data:TMemoryStream; var error: string; timeOut: integer): Boolean;
var
size: Int64;
begin
Result := False;
if Data = nil then
Data := TMemoryStream.Create;
SslHttpCli3.URL := url;
SslHttpCli3.Timeout := timeOut;
try
try
SslHttpCli3.Get;
except on E:Exception do // 400
error := E.Message;
end;
finally
Result := (SslHttpCli3.StatusCode = 200) or (SslHttpCli3.StatusCode = 400);
size := 0;
try
if Assigned(SslHttpCli3.RcvdStream) then begin
SslHttpCli3.RcvdStream.Seek(0, soFromBeginning);
size := SslHttpCli3.RcvdStream.Size;
end;
if size > 0 then begin
Data.Clear;
Data.LoadFromStream( SslHttpCli3.RcvdStream );
end
else
error := 'ERROR! 0 byte answer. ' + error;
except on E: Exception do
hiba := '! Stream read error: ' + CRLF + E.Message;
end;
if Assigned(SslHttpCli3.SendStream) then SslHttpCli3.SendStream.Size := 0;
if Assigned(SslHttpCli3.RcvdStream) then SslHttpCli3.RcvdStream.Size := 0;
end;
end;
Is this "normal" ?