@@ -18,7 +18,10 @@ interface
1818 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
1919 ExtCtrls, CheckLst, DecodeTorrent, LCLType, ActnList, Menus, ComCtrls,
2020 Grids, controlergridtorrentdata, torrent_miscellaneous,
21- controler_trackerlist_online, controler_treeview_torrent_data, ngosang_trackerslist;
21+ controler_trackerlist_online, controler_treeview_torrent_data, ngosang_trackerslist,
22+ fphttpclient,// ssockets, sslsockets, fpopenssl,
23+ // openssl, { This implements the procedure InitSSLInterface }
24+ opensslsockets;
2225
2326type
2427
@@ -195,6 +198,8 @@ TFormTrackerModify = class(TForm)
195198 False): boolean;
196199 procedure LoadTrackersTextFileAddTrackers (Temporary_SkipAnnounceCheck: boolean);
197200 procedure LoadTrackersTextFileRemoveTrackers ;
201+ // procedure GetSocketHandler(Sender: TObject; const UseSSL: Boolean; out
202+ // AHandler: TSocketHandler);
198203 public
199204 { public declarations }
200205 end ;
@@ -204,7 +209,7 @@ TFormTrackerModify = class(TForm)
204209
205210implementation
206211
207- uses fphttpclient, LCLIntf, lazutf8, LazFileUtils, trackerlist_online;
212+ uses LCLIntf, lazutf8, LazFileUtils, trackerlist_online, sslbase ;
208213
209214const
210215 RECOMENDED_TRACKERS: array [0 ..2 ] of UTF8String =
@@ -1821,23 +1826,63 @@ procedure TFormTrackerModify.ShowHourGlassCursor(HourGlass: boolean);
18211826
18221827end ;
18231828
1829+
1830+ //
1831+ // procedure TFormTrackerModify.GetSocketHandler(Sender: TObject; const UseSSL: Boolean; out
1832+ // AHandler: TSocketHandler);
1833+ // begin
1834+ // AHandler := TSSLSocketHandler.Create;
1835+ // TSSLSocketHandler(AHandler).SSLType := stTLSv1_2;
1836+ // end;
1837+ //
1838+
18241839function TFormTrackerModify.TestConnectionSSL : Boolean;
1840+ var
1841+ HTTPClient: TFPHTTPClient;
18251842begin
1826- Result := ParamCount = 1 ;
1827- if Result then
1828- begin
1829- // Check for the correct parameter.
1830- Result := UTF8Trim(ParamStr(1 )) = ' -TEST_SSL' ;
1831- if Result then
1832- begin
1833- // Check if there is SLL connection
1834- try
1835- TFPCustomHTTPClient.SimpleGet(' https://raw.githubusercontent.com/gerryferdinandus/bittorrent-tracker-editor/master/.travis.yml' );
1836- except
1837- // No SLL or no internet connection.
1838- System.ExitCode := 1 ;
1839- end ;
1843+ { SSL initialization has to be done by hand here }
1844+ // InitSSLInterface;
1845+
1846+ Result := False;
1847+ HTTPClient := TFPHTTPClient.Create(nil );
1848+ try
1849+ // HTTPClient.OnDataReceived := @DataReceived;
1850+ // HTTPClient.OnGetSocketHandler := @GetSocketHandler;
1851+ HTTPClient.AllowRedirect := True;
1852+ // HTTPClient.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');
1853+ try
1854+ // HTTPClient.Get(AFrom, ATo);
1855+ HTTPClient.Get(' https://github.com' );
1856+ HTTPClient.Get(' https://raw.githubusercontent.com/gerryferdinandus/bittorrent-tracker-editor/master/README.md' ); // donot work
1857+
1858+ HTTPClient.Get(' https://google.com/' ); // works
1859+ Result := True;
1860+ except
1861+ on E: Exception do
1862+ ShowMessage(E.Message)
18401863 end ;
1864+ finally
1865+ HTTPClient.Free;
18411866 end ;
1867+ // begin
1868+ // TFPCustomHTTPClient.SimpleGet('https://raw.githubusercontent.com/gerryferdinandus/bittorrent-tracker-editor/master/README.md');
1869+ //
1870+ //
1871+ // Result := ParamCount = 1;
1872+ // if Result then
1873+ // begin
1874+ // // Check for the correct parameter.
1875+ // Result := UTF8Trim(ParamStr(1)) = '-TEST_SSL';
1876+ // if Result then
1877+ // begin
1878+ // // Check if there is SLL connection
1879+ // try
1880+ // TFPCustomHTTPClient.SimpleGet('https://raw.githubusercontent.com/gerryferdinandus/bittorrent-tracker-editor/master/README.md');
1881+ // except
1882+ // //No SLL or no internet connection.
1883+ // System.ExitCode := 1;
1884+ // end;
1885+ // end;
1886+ // end;
18421887end ;
18431888end .
0 commit comments