Pass a big portion of Autobahn over SSL

This commit is contained in:
Alex Hultman
2018-11-29 09:59:03 +01:00
parent 6c9ac88f50
commit 3e769fb841
5 changed files with 55 additions and 12 deletions
+8 -2
View File
@@ -31,10 +31,13 @@
namespace uWS {
template <bool SSL>
struct TemplatedApp {
struct TemplatedApp : StaticDispatch<SSL> {
private:
/* The app always owns at least one http context, but creates websocket contexts on demand */
HttpContext<SSL> *httpContext;
using SOCKET_TYPE = typename StaticDispatch<SSL>::SOCKET_TYPE;
using StaticDispatch<SSL>::static_dispatch;
public:
~TemplatedApp() {
@@ -62,7 +65,8 @@ public:
/* If we are the first one to use compression, initialize it */
if (behavior.compression) {
LoopData *loopData = (LoopData *) us_loop_ext(us_socket_context_loop(webSocketContext->getSocketContext()));
LoopData *loopData = (LoopData *) us_loop_ext(static_dispatch(us_ssl_socket_context_loop, us_socket_context_loop)(webSocketContext->getSocketContext()));
if (!loopData->inflationStream) {
loopData->inflationStream = new InflationStream;
@@ -121,6 +125,8 @@ public:
behavior.open(webSocket, req);
}
std::cout << "oh hey!" << std::endl;
} else {
/* For now we do not support having HTTP and websocket routes on the same URL */
res->close();