diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 88dd3b4f7..bab6ec822 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -135,6 +135,11 @@
+
+
+
+ True
+
True
@@ -144,8 +149,6 @@
-
-
@@ -153,6 +156,9 @@
True
+
+ True
+
True
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index d9d9d23bd..f0bd610bd 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -597,6 +597,12 @@
beast\asio
+
+ beast\asio
+
+
+ beast\asio\impl
+
beast\asio\impl
@@ -609,9 +615,6 @@
beast\asio
-
- beast\asio
-
beast\asio
@@ -621,6 +624,9 @@
beast\asio\tests
+
+ beast\asio\tests
+
beast\asio\tests
diff --git a/src/beast/beast/asio/Asio.unity.cpp b/src/beast/beast/asio/Asio.unity.cpp
index fbc81d76f..fb6ff5ca2 100644
--- a/src/beast/beast/asio/Asio.unity.cpp
+++ b/src/beast/beast/asio/Asio.unity.cpp
@@ -22,6 +22,8 @@
#endif
#include
+#include
#include
#include
+#include
diff --git a/src/beast/beast/asio/ssl.h b/src/beast/beast/asio/error.h
similarity index 81%
rename from src/beast/beast/asio/ssl.h
rename to src/beast/beast/asio/error.h
index b9cff3fad..342e0fee3 100644
--- a/src/beast/beast/asio/ssl.h
+++ b/src/beast/beast/asio/error.h
@@ -17,11 +17,11 @@
*/
//==============================================================================
-#ifndef BEAST_ASIO_SSL_H_INCLUDED
-#define BEAST_ASIO_SSL_H_INCLUDED
+#ifndef BEAST_ASIO_ERROR_H_INCLUDED
+#define BEAST_ASIO_ERROR_H_INCLUDED
+#include
#include
-#include
namespace beast {
namespace asio {
@@ -32,8 +32,12 @@ bool
is_short_read (boost::system::error_code const& ec)
{
return (ec.category() == boost::asio::error::get_ssl_category())
- && (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ);
+ && (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ);
}
+
+/** Returns a human readable message if the error code is SSL related. */
+std::string
+asio_message(boost::system::error_code const& ec);
}
}
diff --git a/src/beast/beast/asio/impl/error.cpp b/src/beast/beast/asio/impl/error.cpp
new file mode 100644
index 000000000..c97b15a15
--- /dev/null
+++ b/src/beast/beast/asio/impl/error.cpp
@@ -0,0 +1,59 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include
+#include
+
+namespace beast {
+namespace asio {
+
+// This buffer must be at least 120 bytes, most examples use 256.
+// https://www.openssl.org/docs/crypto/ERR_error_string.html
+static std::uint32_t const errorBufferSize (256);
+
+std::string
+asio_message (boost::system::error_code const& ec)
+{
+ std::string error;
+
+ if (ec.category () == boost::asio::error::get_ssl_category ())
+ {
+ error = " ("
+ + boost::lexical_cast (ERR_GET_LIB (ec.value ()))
+ + ","
+ + boost::lexical_cast (ERR_GET_FUNC (ec.value ()))
+ + ","
+ + boost::lexical_cast (ERR_GET_REASON (ec.value ()))
+ + ") ";
+
+ //
+ char buf[errorBufferSize];
+ ::ERR_error_string_n (ec.value (), buf, errorBufferSize);
+ error += buf;
+ }
+ else
+ {
+ error = ec.message ();
+ }
+
+ return error;
+}
+
+}
+}
diff --git a/src/beast/beast/asio/tests/error_test.cpp b/src/beast/beast/asio/tests/error_test.cpp
new file mode 100644
index 000000000..bc64109de
--- /dev/null
+++ b/src/beast/beast/asio/tests/error_test.cpp
@@ -0,0 +1,44 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include
+#include
+#include
+
+namespace beast {
+namespace asio {
+
+class error_test : public unit_test::suite
+{
+public:
+ void run ()
+ {
+ {
+ boost::system::error_code ec = boost::system::error_code (335544539,
+ boost::asio::error::get_ssl_category ());
+ std::string const s = beast::asio::asio_message (ec);
+ expect(s == " (20,0,219) error:140000DB:SSL routines:SSL routines:short read");
+ }
+ }
+};
+
+BEAST_DEFINE_TESTSUITE(error,asio,beast);
+
+}
+}
diff --git a/src/ripple/server/impl/Peer.h b/src/ripple/server/impl/Peer.h
index a95a11984..b52f23625 100644
--- a/src/ripple/server/impl/Peer.h
+++ b/src/ripple/server/impl/Peer.h
@@ -25,7 +25,7 @@
#include
#include
#include
-#include // for is_short_read?
+#include // for is_short_read?
#include
#include
#include