diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-11-19 14:35:40 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-11-19 14:35:40 +0000 |
commit | 7bee4140e886773a370b76eec80a264c0e7f142d (patch) | |
tree | ec3d61256dbec93a68d7a28891546ecbb1af592d | |
parent | cc48658564dad6cd57b7526ab1e98780145a473f (diff) |
respect bits.close even if an error already is set, but make sure that the
existing error is the one returned back
-rw-r--r-- | lib/url.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -3236,9 +3236,15 @@ CURLcode Curl_done(struct connectdata *conn) if conn->bits.close is TRUE, it means that the connection should be closed in spite of all our efforts to be nice, due to protocol restrictions in our or the server's end */ - if(data->set.reuse_forbid || - ((CURLE_OK == result) && conn->bits.close)) - result = Curl_disconnect(conn); /* close the connection */ + if(data->set.reuse_forbid || conn->bits.close) { + CURLcode res2; + res2 = Curl_disconnect(conn); /* close the connection */ + + /* If we had an error already, make sure we return that one. But + if we got a new error, return that. */ + if(!result && res2) + result = res2; + } else infof(data, "Connection #%d left intact\n", conn->connectindex); |