Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS/HTTPS (semi) support #265

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Socket.IO Lib uses _asio_, _rapidjson_, and _websocketpp_. SIOJson is originally
[Unreal Forum Thread](https://forums.unrealengine.com/showthread.php?110680-Plugin-Socket-io-Client)


Recommended socket.io server version: 1.4+.
Recommended socket.io server version: 3.0+

*Tip: This is a sizeable readme, quickly find your topic with ```Ctrl+F``` and a search term e.g. namespaces*

Expand All @@ -22,8 +22,31 @@ Current platform issues:
* Xbox/PS4 platform untested - see [issue 117](https://github.com/getnamo/socketio-client-ue4/issues/117)
* Lumin platform untested - see [issue 114](https://github.com/getnamo/socketio-client-ue4/issues/114)

HTTPS currently not yet supported
* OpenSSL Support - [issue39](https://github.com/getnamo/socketio-client-ue4/issues/39), temporary [workaround available](https://github.com/getnamo/socketio-client-ue4/issues/72#issuecomment-371956821).
HTTPS is only supported through a little change in the source code.
* OpenSSL Support - <a href="https://github.com/dobby5/socketio-client-ue4/blob/0d3420f626704802d457e125bf01d0d4d26bbfe3/Source/SocketIOLib/SocketIOLib.Build.cs#L63-L73">Remove this declaration and compile the code, that's all.</a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a merge please change this line with your branch @getnamo


## Compatibility table

<table>
<tr>
<th rowspan="2">UE4 Socket.IO plugin version</th>
<th colspan="2">Socket.IO server version</th>
</tr>
<tr>
<td align="center">1.x / 2.x</td>
<td align="center">3.x / 4.x</td>
</tr>
<tr>
<td><a href="https://github.com/getnamo/socketio-client-ue4/releases/tag/1.5.5">Up to tag 1.5.5</a></td>
<td align="center">YES</td>
<td align="center">NO</td>
</tr>
<tr>
<td><a href="https://github.com/dobby5/socketio-client-ue4">1.6+ (master branch)</a></td>
<td align="center">NO</td>
<td align="center">YES</td>
</tr>
</table>

## Quick Install & Setup ##

Expand Down
4 changes: 3 additions & 1 deletion Source/SocketIOLib/Private/internal/sio_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ namespace sio
#if SIO_TLS
client_impl::context_ptr client_impl::on_tls_init(connection_hdl conn)
{
context_ptr ctx = context_ptr(new asio::ssl::context(asio::ssl::context::tlsv1));
context_ptr ctx = context_ptr(new asio::ssl::context(asio::ssl::context::tlsv12));
asio::error_code ec;
ctx->set_options(asio::ssl::context::default_workarounds |
asio::ssl::context::no_sslv2 |
Expand All @@ -639,6 +639,8 @@ namespace sio
cerr << "Init tls failed,reason:" << ec.message() << endl;
}

ctx->set_verify_mode(asio::ssl::verify_none);

return ctx;
}
#endif
Expand Down
18 changes: 14 additions & 4 deletions Source/SocketIOLib/Private/internal/sio_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,26 @@

#if defined(DEBUG)
#if SIO_TLS
#include <websocketpp/config/debug_asio.hpp>
typedef websocketpp::config::debug_asio_tls client_config;
#define UI UI_ST
THIRD_PARTY_INCLUDES_START
#include "openssl/hmac.h"
#include <websocketpp/config/debug_asio.hpp>
typedef websocketpp::config::debug_asio_tls client_config;
THIRD_PARTY_INCLUDES_END
#undef UI
#else
#include <websocketpp/config/debug_asio_no_tls.hpp>
typedef websocketpp::config::debug_asio client_config;
#endif //SIO_TLS
#else
#if defined(SIO_TLS)
#include <websocketpp/config/asio_client.hpp>
typedef websocketpp::config::asio_tls_client client_config;
#define UI UI_ST
THIRD_PARTY_INCLUDES_START
#include "openssl/hmac.h"
#include <websocketpp/config/asio_client.hpp>
typedef websocketpp::config::asio_tls_client client_config;
THIRD_PARTY_INCLUDES_END
#undef UI
#else
#include <websocketpp/config/asio_no_tls_client.hpp>
typedef websocketpp::config::asio_client client_config;
Expand Down
16 changes: 14 additions & 2 deletions Source/SocketIOLib/SocketIOLib.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,27 @@ public SocketIOLib(ReadOnlyTargetRules Target) : base(Target)
{
"CoreUObject",
"Engine",
"OpenSSL"
}
);


DynamicallyLoadedModuleNames.AddRange(
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
}
);

/*
//Setup TLS support | Maybe other platforms work as well (untested)
if (Target.Platform == UnrealTargetPlatform.Win64 ||
Target.Platform == UnrealTargetPlatform.Win32 ||
Target.Platform == UnrealTargetPlatform.Mac ||
Target.Platform == UnrealTargetPlatform.IOS
)
{
PublicDefinitions.Add("SIO_TLS");
}
*/
}
}
}