1

Topic: Indy and SSL. There are still defects?

Good afternoon. There is in general a standard code of loading https pages

procedure LoadUrl (const aUrl:string; var IsPageLoaded:Boolean; var HtmlCode:string);
var
ServerCharset:string;
Buffer: TBytes;
fIdHttp:TidHTTP;
fSSL:TIdSSLIOHandlerSocketOpenSSL;
fStream: TMemoryStream;
begin
fIdHttp: = TIdHTTP.Create (nil);
fSSL: = TIdSSLIOHandlerSocketOpenSSL.Create (nil);
//fSSL.SSLOptions. Method: = sslvTLSv1;
fStream: = TMemoryStream. Create;
try
try
fIdHttp. IOHandler: = fSSL;
fIdHttp.Request.UserAgent:=GetRandomUserAgent;
fIdHttp. ConnectTimeout: = 30000;
fIdHttp. ReadTimeout: = 30000;
fIdHttp. HandleRedirects: = True;
fIdHttp. Request. Connection: = ' keep-alive ';
fIdHttp.HTTPOptions:=fIdHttp.HTTPOptions+ [hoNoParseMetaHTTPEquiv];
fIdHttp. Get (aUrl, fStream);
ServerCharset: = AnsiLowerCase (fIdHttp. Response. CharSet);
fStream. Position: = 0;
SetLength (Buffer, fStream. Size);
fStream. Read (Buffer [0], Length (Buffer));
HtmlCode: = (CodePageConvert (Buffer, ServerCharset));
IsPageLoaded: = True;
except
on E:Exception do
begin
HtmlCode:=aUrl+#32+#32+#32+E.Message;
IsPageLoaded: = False;
end;
end;
finally
FreeAndNil (fIdHttp);
FreeAndNil (fSSl);
FreeAndNil (fStream);
end;
end;

And all works
Except a site https://aftershock.news/
There instead of a page html-code it is loaded:
<
Question: nobody in course that it for nonsense?

2

Re: Indy and SSL. There are still defects?

gzip

3

Re: Indy and SSL. There are still defects?

Something is necessary like:

if (header. ContentEncoding = ' gzip ') or (header. ContentEncoding = ' deflate ') then
DecompressGZip (fStream);

4

Re: Indy and SSL. There are still defects?

All is easier much more

fElkaIdCompressorZLib: TIdCompressorZLib;
fElkaIdHTTP: TIdHTTP;
...
fElkaIdHTTP.Compressor: = fElkaIdCompressorZLib;

And forward.

5

Re: Indy and SSL. There are still defects?

Vizit0r, thanks, appear   not clearly what for till now put compression. And it in 21 century

6

Re: Indy and SSL. There are still defects?

It is simple someone .
It is enough to sit absolutely slightly on an Internet 2G or hardly moving satellite - and at once questions about 21 centuries and gzio disappear.

7

Re: Indy and SSL. There are still defects?

Vizit0r wrote:

it is simple someone .
It is enough to sit absolutely slightly on an Internet 2G or hardly moving satellite - and at once questions about 21 centuries and gzio disappear.

+1
It is enough to leave for limits of any city of kilometers  on 100, especially in Siberia, and stable 2G will be for happiness))))

8

Re: Indy and SSL. There are still defects?

Pcrepair wrote:

what for till now puts compression

Unless so pages are not fast loaded?
Can still any cachings ?

9

Re: Indy and SSL. There are still defects?

Aha,
Still  to do already pages in 5,  not to use, with pictures is accurater, and other garbage () to delete
Then also the page will not weigh 5 Mb

10

Re: Indy and SSL. There are still defects?

Pcrepair wrote:

then also the page will not weigh 5 Mb

Yours words, yes "" in ears...

11

Re: Indy and SSL. There are still defects?

Pcrepair wrote:

aha,
Still  to do already pages in 5,  not to use, with pictures is accurater, and other garbage () to delete
Then also the page will not weigh 5 Mb

It would be ideal.