Skip to content
Tcl Source Code View Ticket
Login

View Ticket

http::geturl should not vwait when used asynchronously

Closed / Fixed1253676fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 4 years ago
Descriptionplain2005-08-07 20:03:55
When http::geturl is called with -command and -timeout
> 0 it should not vwait for the socket connection to be
established. Instead it should return immediately to
the caller and do any further actions in event handlers.

See also http://wiki.tcl.tk/1255

Here's the original discussion on the Tcler's chat
about this subject:
[21:30]schelteHow sneaky, http::geturl uses a vwait 
[21:32]kbk_schelte - But you can get it to return
immediately by giving it -command
[21:33]schelteThat's what I'm doing. It still uses
vwait for opening the socket in -async mode ...
[21:35]kbk_Not if -timeout is 0.
[21:36]schelteYeah, but of course it isn't. Can't
hang up the program because a site cannot be reached.
[21:37]kbk_You're right, it would be better to
isolate the continuation.  Best to log a feature
request on that. I tak it that The Right Thing would be
to make the part of geturl after line 372 or so into a
callback?
[21:38]kbk_There doesn't appear to be much state
being passed from before that point to after it, so
that mightn't even be that difficult.
[21:43]schelteThis is only true if both -command and
-timeout are specified.
[21:43]schelteIf only -timeout is used, the current
method will still have to be used.
[21:45]kbk_Right.
[21:45]kbk_In that case, we should still set up the
callback, but then a vwait is appropriate; the caller's
asked for it.
[21:48]schelteYes, it just makes the code a bit more
complicated.
[21:49]kbk_Not even that bad - the callback structure
would be the same in all cases.  It's just a decision
that if there is no -command, then vwait before returning.
kjnashplain2022-09-09 17:41:58
This abuse of vwait, disguised as http::wait, was fixed in [c2dabc4396] on 2013-01-17.

The fix was merged into core-8-5-branch in [e47216d06d] on 2013-04-04, and into the trunk in [b242bb3e4b] on 2013-01-23.

The bug was duplicated as [2911139] which provided the fix.
Log in (anonymous is fine) to add a comment.