[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev timeouts
Re: lynx-dev timeouts
Mon, 28 Feb 2000 12:24:10 +0400 (SAMT)
On Sun, 27 Feb 2000, Klaus Weide wrote:
> On Thu, 27 Jan 2000, Vlad Harchev wrote:
> > On Thu, 27 Jan 100, T.E.Dickey wrote:
> > > > When trying to connect to a web site which may be locked up, lynx will
> > > > sit
> > > > there. Is there a timeout parameter I can set to, say, 10 sec?
> > >
> > > The usual approach is to compile with nsl-fork, and press 'z' when you get
> > > bored.
> > I'm thinking about doing a patch that will add new lynx.cfg and
> > commandline
> > option named "connect_timeout", that will specify the number of seconds to
> > wait before timing out (it will be multiplied by 10 to get the max number of
> > iterations with 'select' to perform, see function HTDoConnect). I looked at
> > the code and seems it's clear how to do it. This functionality won't be
> > available for DOS (look at the code for the answer). Are there any
> > additional
> > thoughts or objections?
> Lynx will notice when the connect() call times out. Use operating
> system's (or TCP/IP stack's) way of changing that timeout, and it can
> apply to all applications (that open a TCP connection) instead of just
> > Seems this will be useful for guys that (ab)use lynx as downloader.
> If lynx -download is invoked interactively, they can still use ^C.
> If lynx -download is invoked non-interactively, it should be possible
> to invoke a timeout in shell language. Not for the connect(), but for
> the whole retrieval.
> Ok, let's try:
> ---- snip ---
> #! /bin/sh
> LYNX="./src/lynx" # change this, e.g. to "lynx"
> if [ $# -lt 2 ]; then
> echo "tolynx - invoke lynx with timeout." >&2
> echo "Usage: $0 TIMEOUT LYNXOPTIONS URL" >&2
> echo " LYNXOPTIONS should include -dump." >&2
> exit 1
> $LYNX "$@" &
> sleep $TIMEOUT
> kill -0 $CHILDPID 2>/dev/null && kill $CHILDPID
> exit 0
> --- snip ---
> Tested with bash, ash, pdksh.
> Tweak as desired to make it smarter, using a loop so that it
> can finish immediately when the lynx process is done etc.
> (see also shells' man pages for the 'wait' builtin).
Yes, this could be a solution that limits the time of entire download
section. But if there are several http redirects from the servers, lynx.cfg
setting applies to each connection, not to total connection time.
Same for recursive download - it's possible to limit total job time using
script like this (and that time can't be estimated before downloading), but
it's impossible to limit timeout for each connect.