Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
TFPHTTPClient with proxy and HTTPS protocol
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Chat gpt is designed to l...
by
TBMan
[
Today
at 04:25:34 am]
Compiler raised internal ...
by
TYDQ
[
Today
at 03:27:23 am]
I can write your README.m...
by
schuler
[
Today
at 03:13:59 am]
Periodic Table
by
440bx
[
Today
at 01:56:31 am]
Problema ao Instalar BGRA...
by
Fred vS
[May 18, 2025, 11:46:48 pm]
crtbeginS.o and crtendS.o...
by
Aruna
[May 18, 2025, 11:38:30 pm]
BGRA Controls
by
Fred vS
[May 18, 2025, 11:33:52 pm]
External ACCESS VIOLATION...
by
alpine
[May 18, 2025, 11:30:10 pm]
Icon file was loaded on m...
by
n7800
[May 18, 2025, 10:26:06 pm]
PascalScada installing
by
jamie
[May 18, 2025, 10:24:44 pm]
Build mode Help button do...
by
440bx
[May 18, 2025, 10:20:17 pm]
Negative offset
by
ASerge
[May 18, 2025, 10:16:37 pm]
Feature request/suggestio...
by
440bx
[May 18, 2025, 10:15:56 pm]
64 bits and PascalScript
by
jamie
[May 18, 2025, 10:10:03 pm]
A little bug in fpsimages...
by
Roni Wolf
[May 18, 2025, 09:38:07 pm]
Please post your ptop con...
by
Crispy Lettuce
[May 18, 2025, 08:29:57 pm]
BGRAGtkBitmap
by
CM630
[May 18, 2025, 08:04:12 pm]
FPC for high-performance ...
by
Fibonacci
[May 18, 2025, 07:55:58 pm]
New version of BGRABitmap
by
circular
[May 18, 2025, 06:28:42 pm]
FPC 3.2.2 - compilerproc ...
by
Thaddy
[May 18, 2025, 05:48:02 pm]
LazUpdateManager – Lazaru...
by
babycode
[May 18, 2025, 04:38:06 pm]
WPARAM definition
by
Thaddy
[May 18, 2025, 04:16:52 pm]
FPC 3.2.2 - Align for Ans...
by
marcov
[May 18, 2025, 03:36:05 pm]
Little Red Riding Hood (t...
by
Lulu
[May 18, 2025, 03:00:19 pm]
Hnefatafl Viking-Chess(ra...
by
Jonax
[May 18, 2025, 11:50:30 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: TFPHTTPClient with proxy and HTTPS protocol (Read 11057 times)
Abelisto
Jr. Member
Posts: 91
TFPHTTPClient with proxy and HTTPS protocol
«
on:
August 03, 2018, 05:26:24 am »
Is the subj possible? If yes - how?
There is the simple test program:
Code: Pascal
[Select]
[+]
[-]
program
proxy
;
{$mode objfpc}{$H+}
uses
Classes
,
SysUtils
,
openssl
,
fphttpclient
;
procedure
SetProxy
(
AHttp
:
TFPHTTPClient
;
const
AUrl
:
string
)
;
var
i
:
Integer
;
begin
with
AHttp
.
Proxy
do
begin
if
AUrl <>
''
then
begin
i
:
=
Pos
(
':'
,
AUrl
)
;
Host
:
=
Copy
(
AUrl
,
1
,
i
-
1
)
;
Port
:
=
StrToInt
(
Copy
(
AUrl
,
i
+
1
,
Length
(
AUrl
)
)
)
;
UserName
:
=
''
;
Password
:
=
''
;
Writeln
(
ErrOutput
,
Format
(
'Set proxy Host: %s, Port: %d'
,
[
Host
,
Port
]
)
)
;
end
else
begin
Host
:
=
''
;
Port
:
=
0
;
UserName
:
=
''
;
Password
:
=
''
;
end
;
end
;
end
;
var
url
,
proxy
:
string
;
http
:
TFPHTTPClient
;
responce
:
string
;
begin
if
ParamCount >
1
then
begin
proxy
:
=
ParamStr
(
1
)
;
url
:
=
ParamStr
(
2
)
;
end
else
begin
proxy
:
=
''
;
url
:
=
ParamStr
(
1
)
end
;
http
:
=
TFPHttpClient
.
Create
(
nil
)
;
http
.
IOTimeout
:
=
5000
;
SetProxy
(
http
,
proxy
)
;
responce
:
=
http
.
Get
(
url
)
;
Writeln
(
responce
)
;
http
.
Free
;
end
.
Next calls works just fine:
./proxy 185.93.3.123:8080
http://www.lazarus-ide.org
./proxy
https://www.lazarus-ide.org
curl --proxy 185.93.3.123:8080
https://www.lazarus-ide.org
But
./proxy 185.93.3.123:8080
https://www.lazarus-ide.org
gives
ESocketError: Connect to 185.93.3.123:8080 failed.
«
Last Edit: August 03, 2018, 07:34:23 am by Abelisto
»
Logged
OS: Linux Mint + MATE, Compiler: FPC trunk (yes, I am risky!), IDE: Lazarus trunk
Thaddy
Hero Member
Posts: 16945
Ceterum censeo Trump esse delendam
Re: TFPHTTPClient with proxy and HTTPS protocol
«
Reply #1 on:
August 03, 2018, 12:29:38 pm »
Well. Use trunk for that. There have been quite a few changes including a related one with an example in the last few weeks.
Logged
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.
Abelisto
Jr. Member
Posts: 91
Re: TFPHTTPClient with proxy and HTTPS protocol
«
Reply #2 on:
August 03, 2018, 02:12:41 pm »
@Thaddy Thanks, but it seems that the result is same, even with
packages/fcl-web/examples/httpclient/httpget.pas
example.
Logged
OS: Linux Mint + MATE, Compiler: FPC trunk (yes, I am risky!), IDE: Lazarus trunk
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
TFPHTTPClient with proxy and HTTPS protocol
TinyPortal
© 2005-2018