summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-01-16 14:20:01 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-01-16 14:20:01 (GMT)
commit7a28ca58d78656d8cac01cff71138f393cb52b5d (patch)
tree273cbb799949db5ba14db04f6d429dd2143488fa
parent9b9a88cd34149fc95d3ffdd23d657e7b3daf0c7d (diff)
parentd18fb9089e240310aa9bbf393a7feec2718aa6f3 (diff)
downloadtcl-7a28ca58d78656d8cac01cff71138f393cb52b5d.zip
tcl-7a28ca58d78656d8cac01cff71138f393cb52b5d.tar.gz
tcl-7a28ca58d78656d8cac01cff71138f393cb52b5d.tar.bz2
merge from 8.5 main branch
-rw-r--r--ChangeLog5
-rw-r--r--doc/socket.n3
-rw-r--r--library/http/http.tcl6
3 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ffc3cfb..eac6e29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-13 Donal K. Fellows <dkf@users.sf.net>
+
+ * 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 <nijtmans@users.sf.net>
* generic/tclUtf.c: [Bug 3464428] string is graph \u0120 is wrong
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
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 9c2d43d..e7224a2 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -863,12 +863,12 @@ proc http::cleanup {token} {
proc http::Connect {token} {
variable $token
upvar 0 $token state
- global errorInfo errorCode
+ set err "due to unexpected EOF"
if {
[eof $state(sock)] ||
- [string length [fconfigure $state(sock) -error]]
+ [set err [fconfigure $state(sock) -error]] ne ""
} then {
- Finish $token "connect failed [fconfigure $state(sock) -error]" 1
+ Finish $token "connect failed $err" 1
} else {
set state(status) connect
fileevent $state(sock) writable {}