Author: rhuijben
Date: Thu Oct 29 15:17:27 2015
New Revision: 1711290
URL: http://svn.apache.org/viewvc?rev=1711290&view=rev
Log:
Following up on r1711286, improve detection and add a comment to the
ssl buckets.
* buckets/ssl_buckets.c
(status_from_ssl_error): Add comment on how to obtain more specific error
information.
* test/MockHTTPinC/MockHTTP_server.c
(sslHandshake): Verify that the error originates in the right library.
Modified:
serf/trunk/buckets/ssl_buckets.c
serf/trunk/test/MockHTTPinC/MockHTTP_server.c
Modified: serf/trunk/buckets/ssl_buckets.c
URL:
http://svn.apache.org/viewvc/serf/trunk/buckets/ssl_buckets.c?rev=1711290&r1=1711289&r2=1711290&view=diff
==============================================================================
--- serf/trunk/buckets/ssl_buckets.c (original)
+++ serf/trunk/buckets/ssl_buckets.c Thu Oct 29 15:17:27 2015
@@ -883,6 +883,16 @@ static apr_status_t status_from_ssl_erro
status = ctx->pending_err;
ctx->pending_err = APR_SUCCESS;
} else {
+ /*unsigned long l = ERR_peek_error();
+ int lib = ERR_GET_LIB(l);
+ int func = ERR_GET_FUNC(l);
+ int reason = ERR_GET_REASON(l);*/
+
+ /* ### Detect more specific errors?
+ When lib is ERR_LIB_SSL, then reason is one of the
+ many SSL_R_XXXX reasons in ssl.h
+ */
+
if (SSL_in_init(ctx->ssl))
ctx->fatal_err = SERF_ERROR_SSL_SETUP_FAILED;
else
Modified: serf/trunk/test/MockHTTPinC/MockHTTP_server.c
URL:
http://svn.apache.org/viewvc/serf/trunk/test/MockHTTPinC/MockHTTP_server.c?rev=1711290&r1=1711289&r2=1711290&view=diff
==============================================================================
--- serf/trunk/test/MockHTTPinC/MockHTTP_server.c (original)
+++ serf/trunk/test/MockHTTPinC/MockHTTP_server.c Thu Oct 29 15:17:27 2015
@@ -2891,10 +2891,12 @@ static apr_status_t sslHandshake(_mhClie
return ssl_ctx->bio_status; /* Usually APR_EAGAIN */
default:
{
+ int lib = ERR_GET_LIB(l);
int func = ERR_GET_FUNC(l);
int reason = ERR_GET_REASON(l);
- if (reason == SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE) {
+ if (lib == ERR_LIB_SSL
+ && 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
@@ -2903,8 +2905,8 @@ static apr_status_t sslHandshake(_mhClie
}
_mhLog(MH_VERBOSE, cctx->skt,
- "SSL Error %d: Function=%d, Reason=%d",
- ssl_err, func, reason);
+ "SSL Error %d: Library=%d, Function=%d, Reason=%d",
+ ssl_err, lib, func, reason);
#if MH_VERBOSE
ERR_print_errors_fp(stderr);
#endif