Overview
| Artifact ID: | 095147adeafc63ea2250bdb84577848b44f1728fbd8193e7292ceee18c8fb589 |
|---|---|
| Ticket: | b5a02c53908e44ca5a21b30df67d3fb305904139
Guard http::Connect against cleared socket info |
| User & Date: | oehhar on 2024-07-16 14:36:39 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
I get the following error trace with TWAPI 4.7.1 enabled TLS for the http package: <verbatim> --ErrorStack-- can't read "state(sock)": no such variable while executing "eof $state(sock)" (procedure "http::Connect" line 7) invoked from within "http::Connect ::http::1 https {} /api/v2/devices/lookup.xml?di=EFRI310227552" --Traceback-- INNER:loadArray1 CALL:http::Connect ::http::1 https {} /api/v2/devices/lookup.xml?di=EFRI310227552 CALL:::twapi::tls::_post_write_event_callback rc0 </verbatim> The TWAPI _post_write_event_callback has the following code: <verbatim> # NOTE: we do not check state here as we should generate an event # even in the CLOSED state - see Bug #206 chan postevent $chan write </verbatim> The http Connect function is as follows: <verbatim> proc http::Connect {token proto phost srvurl} { variable $token upvar 0 $token state set tk [namespace tail $token] set err "due to unexpected EOF" if { [eof $state(sock)] || [set err [fconfigure $state(sock) -error]] ne "" } { </verbatim> I suppose, that http is called by TWAPI after a http cleanup. I think, it would be wise to check for $token existence at the beginning of Connect and just do nothing, if it does not exist. So, insert a line like: <verbatim> if {![info exists state(sock)] } {return} </verbatim> Does this feel like a good idea? Thank you and take care, Harald - foundin changed to: "core-8-6-branch"
- is_private changed to: "0"
- login: "oehhar"
- priority changed to: "5 Medium"
- private_contact changed to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "oehhar"
- subsystem changed to: "29. http Package"
- title changed to: "Guard http::Connect against cleared socket info"
- type changed to: "Bug"