diff --git a/src/App.h b/src/App.h index 57cd04276..e3d922b56 100644 --- a/src/App.h +++ b/src/App.h @@ -61,13 +61,16 @@ namespace uWS { /* This one matches us_socket_context_options_t but has default values */ struct SocketContextOptions { - const char *key_file_name = nullptr; - const char *cert_file_name = nullptr; + union{ const char *key_file_name = nullptr, *key_file; }; + union{ const char *cert_file_name = nullptr, *cert_file; }; const char *passphrase = nullptr; - const char *dh_params_file_name = nullptr; - const char *ca_file_name = nullptr; + union{ const char *dh_params_file_name = nullptr, *dh_params_file; }; + union{ const char *ca_file_name = nullptr, *ca_file; }; const char *ssl_ciphers = nullptr; - int ssl_prefer_low_memory_usage = 0; + char ssl_prefer_low_memory_usage = 0; + char key_data_inline = 0; + char cert_data_inline = 0; + char dh_params_data_inline = 0; /* Conversion operator used internally */ operator struct us_socket_context_options_t() const { @@ -93,6 +96,14 @@ struct TemplatedAppBase { TopicTree *topicTree = nullptr; + BuilderPatternReturnType &&setOptions(const SocketContextOptions& options) { + + /* Options might be more than just SSL in the future */ + us_update_socket_context(SSL, (struct us_socket_context_t *) httpContext, (const struct us_socket_context_options_t*) &options); + + return std::move(static_cast(*this)); + } + /* Server name */ BuilderPatternReturnType &&addServerName(std::string hostname_pattern, SocketContextOptions options = {}) { diff --git a/src/Http3App.h b/src/Http3App.h index 4c54b2955..625c64e73 100644 --- a/src/Http3App.h +++ b/src/Http3App.h @@ -16,6 +16,8 @@ namespace uWS { h3options.key_file_name = strdup(options.key_file_name); h3options.cert_file_name = strdup(options.cert_file_name); h3options.passphrase = strdup(options.passphrase); + h3options.key_data_inline = options.key_data_inline; + h3options.cert_data_inline = options.cert_data_inline; /* Create the http3 context */ http3Context = Http3Context::create((us_loop_t *)Loop::get(), h3options);