Forum > General

fphttpclient: Connect to URL failed.

(1/6) > >>

CM630:
Hi.
The source is below.
When I execute it I get an exception:
Connect to github.com:443 failed.

The URL is okay, what could be wrong?
This code used to work some time ago.
The OS is Win7.



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- unit Unit1;  {$mode objfpc}{$H+}  interface  uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,  fphttpclient, opensslsockets;  type    { TForm1 }    TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private    public    end;  var  Form1: TForm1;    implementation  {$R *.lfm}  function HTTPTest: Boolean;var  HttpClient: TFPHTTPClient;begin  HttpClient := TFPHTTPClient.Create(NIL);  HttpClient.AllowRedirect := True; HttpClient.HTTPMethod('HEAD', 'https://github.com/bgrabitmap/lazpaint/releases/download/v7.2.2/lazpaint7.2.2_setup_win32_win64.exe', NIL, []);  HttpClient.Free;end;    procedure TForm1.Button1Click(Sender: TObject);begin  HTTPTest;end;  end.   

TRon:

--- Quote from: CM630 on July 27, 2024, 11:22:08 am ---Connect to github.com:443 failed.

--- End quote ---
probably a ssl related issue. Have you installed the correct dll's ?

CM630:
I have installed no drivers. I have no idea what SSL is. fphttpclient requires opensslsockets, that is why I have added it in the Uses section.
I am trying to find out why s.o. elses code stopped working for me.

TRon:

--- Quote from: CM630 on July 27, 2024, 11:36:38 am ---I have installed no drivers. I have no idea what SSL is. fphttpclient requires opensslsockets, that is why I have added it in the Uses section.

--- End quote ---
ssl is a security protocol used to access websites.

the unit opensslsockets loads the corresponding dll's for you in order to make use of that for your connection.

However, win7 is very old and i doubt it has installed up to date opensll libraries.

see for example this thread (there are many more so I suggest to do a search).

CM630:
So fphttpclient requires ssl libraries :(
I tried the same code it in Linux Mint, latest version.
I have got the following exception:
Could not initialize OpenSSL library.

Maybe there is way to download files from the internet without installing additional stuff?

Navigation

[0] Message Index

[#] Next page

Go to full version