Recent

Author Topic: Question Regarding FPHTTPClient  (Read 702 times)

AaronCatolico1

  • New Member
  • *
  • Posts: 31
Question Regarding FPHTTPClient
« on: December 15, 2024, 12:56:47 am »
Doe the FPHTTPClient have built in proxy properties for proxy support?

I've tried a variety of both public and private proxies using this class & nothing seems to work.

Is the following syntax the right way to use proxies?:

Code: Pascal  [Select][+][-]
  1. uses
  2.     fphttpclient, openssl, opensslsockets;
  3.  
  4.  
  5.  
  6. procedure TForm1.Button1Click(Sender: TObject);
  7. var
  8.     url, Response:string;
  9.     Client: TFPHttpClient;
  10.  
  11.  
  12. begin
  13.  
  14.     { SSL initialization has to be done by hand here }
  15.       InitSSLInterface;
  16.  
  17.       Client := TFPHttpClient.Create(nil);
  18.       try
  19.         Client.AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)');
  20.         { Allow redirections }
  21.         Client.AllowRedirect := true;
  22.  
  23.         //Proxies:
  24.         Client.Proxy.Host := '198.23.239.134';
  25.         Client.Proxy.Port := 6540;
  26.         Client.Proxy.UserName := edit6.text;
  27.         Client.Proxy.Password := edit7.text;
  28.  
  29.  
  30.  
  31.         memo1.text := Client.Get('https://google.com');
  32.       finally
  33.         Client.Free;
  34.       end;
  35.  
  36. end;
  37.  


The only thing that happens is a "FAILED" message when trying to connect through a proxy.


TRon

  • Hero Member
  • *****
  • Posts: 3928
Re: Question Regarding FPHTTPClient
« Reply #1 on: December 15, 2024, 01:55:58 am »
To answer your SO question, see here.

afaik only http proxies are supported, see also this thread.

Hi, btw  :)
« Last Edit: December 15, 2024, 07:35:58 pm by TRon »
I do not have to remember anything anymore thanks to total-recall.

 

TinyPortal © 2005-2018