Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
timelimit for HTTPMethod
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
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Parametrized Access SQL Q...
by
Khrys
[
Today
at 07:12:03 am]
How to set the Excel cell...
by
dodgex
[
Today
at 06:01:11 am]
BS PanelTrans - transform...
by
Xenno
[
Today
at 05:54:55 am]
Why does FPC behave this ...
by
440bx
[
Today
at 04:41:50 am]
PngDrop: Reduce the size ...
by
ALLIGATOR
[
Today
at 04:05:04 am]
RTTIPropertyGrid expand
by
jamie
[
Today
at 03:17:43 am]
What was your first compu...
by
TBMan
[
Today
at 02:19:55 am]
Fantasy Worldbuilder; Pro...
by
Boleeman
[
Today
at 01:28:33 am]
Sum GNU Anti Reversi 8x8 ...
by
Boleeman
[
Today
at 12:42:53 am]
StrToDateTime problems
by
andyH
[
Today
at 12:28:42 am]
How to forward a Class in...
by
Bart
[January 12, 2026, 10:35:22 pm]
Picture Process with BGRA...
by
circular
[January 12, 2026, 08:05:53 pm]
[SOLVED] Average color
by
LeP
[January 12, 2026, 06:51:24 pm]
set zero values not to b...
by
wp
[January 12, 2026, 06:25:48 pm]
HELP Why the WriteRowHeig...
by
wp
[January 12, 2026, 06:22:24 pm]
building a Calculator usi...
by
Dzandaa
[January 12, 2026, 03:51:20 pm]
How can Lazarus implement...
by
Tommi
[January 12, 2026, 03:46:47 pm]
how to relay a button cli...
by
srvaldez
[January 12, 2026, 01:15:46 pm]
what was your first pasca...
by
BSaidus
[January 12, 2026, 01:01:32 pm]
[SOLVED] Transparent back...
by
alpine
[January 12, 2026, 11:28:56 am]
Lazarus and Libre Office
by
sydenis
[January 12, 2026, 11:07:38 am]
[SOLVED] Able to access p...
by
vinntec
[January 12, 2026, 09:27:53 am]
How to execute PKZIPC fro...
by
Hozso
[January 12, 2026, 08:17:36 am]
Jerky animation (windows)
by
Roland57
[January 12, 2026, 07:19:29 am]
RPNCalc in Lazarus
by
tailkinker
[January 12, 2026, 04:42:09 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: timelimit for HTTPMethod (Read 1559 times)
DeroB73
Newbie
Posts: 6
timelimit for HTTPMethod
«
on:
December 07, 2019, 09:15:21 pm »
Hello
is it possible to set a time limit for the Synapse HTTPMethod GET method ?
I am trying a huge list from URLs to see i they are still alive.
TTPMethod('GET','
http://123.123.123/index
.') works great as long status is 200 but for dead links 400 it takes 2 a 3 seconds that's to long.
Greets
Logged
fjabouley
Full Member
Posts: 129
Re: timelimit for HTTPMethod
«
Reply #1 on:
December 07, 2019, 09:33:18 pm »
Try to add HTTP.Sock.ConnectionTimeout
Code: Pascal
[Select]
[+]
[-]
Function
Getwithtimeout
(
URL
:
string
;
Default_timeout
:
integer
=
1000
)
:
string
;
var
response
:
Tstringlist
;
var
HTTP
:
THTTPSend
;
begin
Result
:
=
''
;
Response
:
=
TStringList
.
Create
;
HTTP
:
=
THTTPSend
.
Create
;
HTTP
.
Timeout
:
=
Default_timeout
;
HTTP
.
Sock
.
ConnectionTimeout
:
=
Default_timeout
;
if
HTTP
.
HTTPMethod
(
'GET'
,
URL
)
then
begin
if
HTTP
.
ResultCode
<>
200
then
begin
// Error : do some stuff
end
else
begin
Response
.
LoadFromStream
(
HTTP
.
Document
)
;
Result
:
=
response
.
Text
;
end
;
end
;
Response
.
Free
;
HTTP
.
Free
;
end
;
or
Code: Pascal
[Select]
[+]
[-]
Function
IsCorrectURL
(
URL
:
string
;
Default_timeout
:
integer
=
1000
)
:
boolean
;
var
response
:
Tstringlist
;
var
HTTP
:
THTTPSend
;
begin
Result
:
=
false
;
HTTP
:
=
THTTPSend
.
Create
;
HTTP
.
Timeout
:
=
Default_timeout
;
HTTP
.
Sock
.
ConnectionTimeout
:
=
Default_timeout
;
if
HTTP
.
HTTPMethod
(
'GET'
,
URL
)
then
if
HTTP
.
ResultCode
=
200
then
Result
:
=
true
;
HTTP
.
Free
;
end
;
«
Last Edit: December 07, 2019, 09:41:56 pm by fjabouley
»
Logged
DeroB73
Newbie
Posts: 6
Re: timelimit for HTTPMethod
«
Reply #2 on:
December 08, 2019, 12:47:52 pm »
thanks fjabouley
it seems i have learn Synapse more in dept.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
timelimit for HTTPMethod
TinyPortal
© 2005-2018