S
S
sbh2016-12-09 06:31:59
Delphi
sbh, 2016-12-09 06:31:59

Why is there an error when accessing the page via https?

DD.
I'm trying to send a post request to a page via https. On google, mail, for example, everything works.
If I try to request https://api.pushbullet.com/v2/pushes , I get an error

1fda7c74ce8d44d18cf423133f532e1b.PNG

. Actually, the problem appeared after the certificate was renewed on the site. Apparently some kind of non-standard encryption is used there and because of this an error occurs.

Has anyone come across?

Const
  push_url = 'https://api.pushbullet.com/v2/pushes';
Var
  PostData:TStringStream;
  Title:string;
  Body:String;
  HTTP:TiDHTTP;
  IdSSLOpenSSL:TIdSSLIOHandlerSocketOpenSSL;
Begin
HTTP:=TiDHTTP.Create();
IdSSLOpenSSL:=TIdSSLIOHandlerSocketOpenSSL.Create();
IdSSLOpenSSL.SSLOptions.SSLVersions:=[sslvSSLv23];
IdSSLOpenSSL.SSLOptions.Method := sslvSSLv23;
IdSSLOpenSSL.SSLOptions.Mode := sslmUnassigned;

HTTP.IOHandler := IdSSLOpenSSL;
Http.Request.CustomHeaders.AddValue('Authorization', 'Bearer ' + APIKey);
HTTP.Request.ContentType := 'application/json';
HTTP.Request.CharSet := 'utf-8';
Title:=Theme;
Body:=Text;
PostData:=TStringStream.Create(Utf8Encode('{"type": "note", "title": "' + Title + '", "body": "'+Body+'"}'));
PostData.Position:=0;
try
  HTTP.Post(push_url,PostData);
finally
  FreeAndNil(PostData);
  FreeAndNil(IdSSLOpenSSL);
  FreeAndNil(HTTP);
end;


I tried to set it manually in the TLS_1_2 component.
45942397df3345d9a249a70dfef2d0ff.PNG
It did not affect it in any way.

Can this error occur due to the fact that such encryption is used on the site?
09b1833efcf246feabe357f1975b3044.PNG

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey S., 2016-12-09
@sbh

on Delphi 10.1 the code works

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question