--------------------- PatchSet 7172 Date: 2005/11/10 23:59:53 Author: hno Branch: ssl-2_5 Tag: (none) Log: Cleanup SSL error management, fixing among other things uploads while there is errors in other SSL sessions Members: src/client_side.c:1.47.2.21.2.31->1.47.2.21.2.32 src/forward.c:1.13.6.1.8.17->1.13.6.1.8.18 src/ssl_support.c:1.6.6.1.2.16->1.6.6.1.2.17 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.47.2.21.2.31 retrieving revision 1.47.2.21.2.32 diff -u -r1.47.2.21.2.31 -r1.47.2.21.2.32 --- squid/src/client_side.c 2 Nov 2005 22:42:33 -0000 1.47.2.21.2.31 +++ squid/src/client_side.c 10 Nov 2005 23:59:53 -0000 1.47.2.21.2.32 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.47.2.21.2.31 2005/11/02 22:42:33 hno Exp $ + * $Id: client_side.c,v 1.47.2.21.2.32 2005/11/10 23:59:53 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3577,6 +3577,8 @@ SSL *ssl = fd_table[fd].ssl; int ret; + errno = 0; + ERR_clear_error(); if ((ret = SSL_accept(ssl)) <= 0) { int ssl_error = SSL_get_error(ssl, ret); switch (ssl_error) { Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/forward.c,v retrieving revision 1.13.6.1.8.17 retrieving revision 1.13.6.1.8.18 diff -u -r1.13.6.1.8.17 -r1.13.6.1.8.18 --- squid/src/forward.c 2 Nov 2005 22:42:33 -0000 1.13.6.1.8.17 +++ squid/src/forward.c 10 Nov 2005 23:59:53 -0000 1.13.6.1.8.18 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.13.6.1.8.17 2005/11/02 22:42:33 hno Exp $ + * $Id: forward.c,v 1.13.6.1.8.18 2005/11/10 23:59:53 hno Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -223,6 +223,9 @@ int ret; ErrorState *err; request_t *request = fwdState->request; + + errno = 0; + ERR_clear_error(); if ((ret = SSL_connect(ssl)) <= 0) { int ssl_error = SSL_get_error(ssl, ret); switch (ssl_error) { Index: squid/src/ssl_support.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ssl_support.c,v retrieving revision 1.6.6.1.2.16 retrieving revision 1.6.6.1.2.17 diff -u -r1.6.6.1.2.16 -r1.6.6.1.2.17 --- squid/src/ssl_support.c 31 May 2005 16:17:26 -0000 1.6.6.1.2.16 +++ squid/src/ssl_support.c 10 Nov 2005 23:59:53 -0000 1.6.6.1.2.17 @@ -436,6 +436,7 @@ if (!CAfile) CAfile = clientCA; + ERR_clear_error(); debug(83, 1) ("Initialising SSL.\n"); switch (version) { case 2: @@ -596,6 +597,7 @@ if (!certfile) certfile = keyfile; + ERR_clear_error(); debug(83, 1) ("Initialising SSL.\n"); switch (version) { case 2: @@ -708,11 +710,13 @@ } #endif + errno = 0; + ERR_clear_error(); i = SSL_read(ssl, buf, len); fd_table[fd].read_pending = COMM_PENDING_NOW; if (i > 0 && SSL_pending(ssl) > 0) { - debug(83, 2) ("SSL fd %d is pending\n", fd); + debug(83, 3) ("SSL fd %d is pending\n", fd); } else if (i <= 0) { int err = SSL_get_error(ssl, i); switch (err) { @@ -735,12 +739,11 @@ break; if (errno == ECONNRESET) break; - debug (83, 1) ("SSL fd %d read error %s (%d)\n", fd, strerror(errno), errno); + debug (83, 2) ("SSL fd %d read error %s (%d)\n", fd, strerror(errno), errno); break; default: debug (83, 2) ("SSL fd %d read error %s (%d/%d)\n", fd, ERR_error_string(ERR_get_error(), NULL), i, err); - i = 0; break; } } @@ -761,6 +764,8 @@ return -1; } + errno = 0; + ERR_clear_error(); i = SSL_write(ssl, buf, len); if (i <= 0) { @@ -785,7 +790,7 @@ break; if (errno == ECONNRESET) break; - debug (83, 1) ("SSL fd %d write error %s (%d)\n", fd, strerror(errno), errno); + debug (83, 2) ("SSL fd %d write error %s (%d)\n", fd, strerror(errno), errno); break; default: @@ -808,6 +813,7 @@ return 0; } + ERR_clear_error(); ret = SSL_shutdown(ssl); if (ret <= 0) { int err = SSL_get_error(ssl, ret); @@ -830,6 +836,7 @@ if (errno == EAGAIN || errno == 0) { errno = EAGAIN; return -1; + break; } default: debug(83, 2) ("WARNING: Unexpected error on SSL_shutdown '%d' (%d)\n", err, errno);