Author: rhuijben
Date: Thu Oct 29 14:46:15 2015
New Revision: 1711286

URL: http://svn.apache.org/viewvc?rev=1711286&view=rev
Log:
Detect a specific SSL error that we trigger during testing and handle that as
a semi success. I hope this fixes the race condition on the MAC/OS buildbot.

* test/MockHTTPinC/MockHTTP_server.c
  (connectToServer): Add comment, noting a potential problem.
  (sslHandshake): Don't handle a client that doesn't report a certificate as
    an APR_EGENERAL that closes the server with an error. The error needs to
    be handled at the client.

Modified:
    serf/trunk/test/MockHTTPinC/MockHTTP_server.c

Modified: serf/trunk/test/MockHTTPinC/MockHTTP_server.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/test/MockHTTPinC/MockHTTP_server.c?rev=1711286&r1=1711285&r2=1711286&view=diff
==============================================================================
--- serf/trunk/test/MockHTTPinC/MockHTTP_server.c (original)
+++ serf/trunk/test/MockHTTPinC/MockHTTP_server.c Thu Oct 29 14:46:15 2015
@@ -286,6 +286,9 @@ static apr_status_t connectToServer(mhSe
         pfd.client_data = cctx;
         STATUSERR(apr_pollset_add(ctx->pollset, &pfd));
         cctx->proxyreqevents = pfd.reqevents;
+
+        /* ### If EINPROGRESS some operations may fail until the
+               socket is really connected. Shouldn't we wait? */
     }
 
     return status;
@@ -2877,6 +2880,7 @@ static apr_status_t sslHandshake(_mhClie
         return APR_SUCCESS;
     } else {
         int ssl_err;
+        unsigned long l = ERR_peek_error();
 
         ssl_err = SSL_get_error(ssl_ctx->ssl, result);
         switch (ssl_err) {
@@ -2886,10 +2890,25 @@ static apr_status_t sslHandshake(_mhClie
             case SSL_ERROR_SYSCALL:
                 return ssl_ctx->bio_status; /* Usually APR_EAGAIN */
             default:
-                _mhLog(MH_VERBOSE, cctx->skt, "SSL Error %d: ", ssl_err);
+                {
+                    int func = ERR_GET_FUNC(l);
+                    int reason = ERR_GET_REASON(l);
+
+                    if (reason == SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE) {
+                        /* The server shouldn't fail for this...
+
+                           We test the client. Go on, and report the problem
+                           there */
+                        return APR_EAGAIN;
+                    }
+
+                    _mhLog(MH_VERBOSE, cctx->skt,
+                           "SSL Error %d: Function=%d, Reason=%d",
+                           ssl_err, func, reason);
 #if MH_VERBOSE
-                ERR_print_errors_fp(stderr);
+                    ERR_print_errors_fp(stderr);
 #endif
+                }
                 return APR_EGENERAL;
         }
     }


Reply via email to