Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-02-29
06:16 • Closed ticket [705956ffff]: http::geturl doesn't cleanup from certain errors... artifact: f8b82566fd user: patthoyts
2004-05-26
11:43 • Ticket [705956ffff]: 4 changes artifact: cf8ba82814 user: davygrvy
11:30 • Ticket [705956ffff]: 4 changes artifact: 19e515f791 user: dgp
05:04 • Ticket [705956ffff]: 4 changes artifact: b99cb189de user: hobbs
2003-12-17
08:24 • Ticket [705956ffff]: 1 change artifact: c8ad12e751 user: davygrvy
2003-07-18
02:09 • Ticket [705956ffff]: 4 changes artifact: 3850155411 user: davygrvy
01:34 • Ticket [705956ffff]: 4 changes artifact: eddcb170c9 user: davygrvy
2003-07-17
07:52 • Ticket [705956ffff]: 4 changes artifact: 218237522d user: davygrvy
06:23 • Ticket [705956ffff]: 4 changes artifact: 34a0ea9884 user: hobbs
2003-03-18
23:50 • New ticket [705956ffff]. artifact: ff675a3539 user: davygrvy

http::geturl doesn't cleanup from certain errors.

Closed / Fixed705956ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 19 years ago
Descriptionplain2003-03-18 23:50:08
in http::geturl near the bottom of the proc is this:

# if state(status) is error, it means someone's 
already called Finish
# to do the above-described clean up.
if {[string equal $state(status) "error"]} {

should be:

# if state(status) is error, it means someone's 
already called Finish
# to do the above-described clean up.
if {![string equal $state(status) "error"]} {

See the new ! in the if expression.  Now the code 
matches the comment and also works to close the 
socket.
hobbsplain2003-07-17 06:23:42
Logged In: YES 
user_id=72656

is there an example test to exploit this?
davygrvyplain2003-07-17 07:52:36
Logged In: YES 
user_id=7549

no, I don't happen to have one.
davygrvyplain2003-07-18 01:34:31
Logged In: YES 
user_id=7549

If it's possible to have a connect, then have writes to the 
socket throw an error, the problem will show itself.
davygrvyplain2003-07-18 02:09:54
Logged In: YES 
user_id=7549

Use httpd on windows for this.  You'll get that server socket 
problem where clients are told connect, but the socket isn't 
actually accepted on the server side.  Happens at about 16 
requests per second on a 500mHz pIII.

Use something like this:

package require http

proc m_httpCallback {token} {
    global howmuch
    set status [::http::status $token]
    ::http::cleanup $token
    puts "[incr howmuch -1] $status"
    if {$howmuch == 0} {puts Done!}
}

proc getem {url count} {
    global howmuch
    set howmuch $count
    for {set i $howmuch} {$i != 0} {incr i -1} {
::http::geturl $url -command [list m_httpCallback]
    }
}

getem http://localhost 200
davygrvy Ticket [705956ffff]: 1 change [History diff]2003-12-17 08:24:09
hobbsplain2004-05-26 05:04:01
Logged In: YES 
user_id=72656

This is from change:
2000-05-29  Sandeep Tamhankar <[email protected]>

I'm not sure that the comment is correct though.  I don't
see any negative effect in calling Finish, nor do I see that
it is called in the above catch already.
dgpplain2004-05-26 11:30:54
Logged In: YES 
user_id=80530


The comment appears correct
to me.  The only code that
sets state(status) to "error"
(once the asynchronous
[geturl] operations are underway)
is in [Finish].  So at line 501...
"if state(status) is error, it
means someone's already called Finish"
is a true statement.

I can't say from that what conclusions
should be drawn.  It's not clear to
me whether [Finish] must be called
exactly once, no more than once,
or any number of times per connection.
See my comments at 513385 about the
need for a major refactoring of the
interwoven nest of routines dealing
with cleanup operations.
davygrvyplain2004-05-26 11:43:36
Logged In: YES 
user_id=7549

but called less than zero, is much too little.
patthoytsplain2008-02-29 06:16:12
Logged In: YES 
user_id=202636
Originator: NO

I've applied this
Log in (anonymous is fine) to add a comment.