From c48f86384d5a792f3bdcda761cd525cb55717a20 Mon Sep 17 00:00:00 2001 From: "ferrieux@users.sourceforge.net" Date: Thu, 12 Jan 2012 20:34:59 +0000 Subject: [Bug 3472316] Document the destructive semantics of [fconfigure -error] on sockets. --- doc/socket.n | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/socket.n b/doc/socket.n index bd307b7..c020839 100644 --- a/doc/socket.n +++ b/doc/socket.n @@ -136,6 +136,9 @@ This option gets the current error status of the given socket. This is useful when you need to determine if an asynchronous connect operation succeeded. If there was an error, the error message is returned. If there was no error, an empty string is returned. + +Note that the error status is reset by the read operation; this mimics +the underlying getsockopt(SO_ERROR) call. .TP \fB\-sockname\fR This option returns a list of three elements, the address, the host name -- cgit v0.12 From 774957af42c715399c7144245640a049bd7deb30 Mon Sep 17 00:00:00 2001 From: "donal.k.fellows@manchester.ac.uk" Date: Fri, 13 Jan 2012 11:45:52 +0000 Subject: * library/http/http.tcl (http::Connect): [Bug 3472316]: Ensure that we only try to read the socket error exactly once. --- ChangeLog | 5 +++++ library/http/http.tcl | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b0d341..6b49989 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-01-13 Donal K. Fellows + + * library/http/http.tcl (http::Connect): [Bug 3472316]: Ensure that we + only try to read the socket error exactly once. + 2012-01-09 Jan Nijtmans * generic/tclUtf.c: [Bug 3464428] string is graph \u0120 is wrong diff --git a/library/http/http.tcl b/library/http/http.tcl index e8a7c1e..1496d63 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -707,10 +707,9 @@ proc http::cleanup {token} { proc http::Connect {token} { variable $token upvar 0 $token state - global errorInfo errorCode if {[eof $state(sock)] || - [string length [fconfigure $state(sock) -error]]} { - Finish $token "connect failed [fconfigure $state(sock) -error]" 1 + [string length [set err [fconfigure $state(sock) -error]]]} { + Finish $token "connect failed $err" 1 } else { set state(status) connect fileevent $state(sock) writable {} -- cgit v0.12 From 63ad08318504e00066e3d3129bee22650511484a Mon Sep 17 00:00:00 2001 From: "donal.k.fellows@manchester.ac.uk" Date: Mon, 16 Jan 2012 13:29:35 +0000 Subject: Ensure that error messages are always set, even in believed-unreachable code. --- library/http/http.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/library/http/http.tcl b/library/http/http.tcl index 1496d63..046cdeb 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -707,6 +707,7 @@ proc http::cleanup {token} { proc http::Connect {token} { variable $token upvar 0 $token state + set err "due to unexpected EOF" if {[eof $state(sock)] || [string length [set err [fconfigure $state(sock) -error]]]} { Finish $token "connect failed $err" 1 -- cgit v0.12