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

Updated interface for uSockets#231 #1796

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 16 additions & 5 deletions src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -93,6 +96,14 @@ struct TemplatedAppBase {

TopicTree<TopicTreeMessage, TopicTreeBigMessage> *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<BuilderPatternReturnType &&>(*this));
}

/* Server name */
BuilderPatternReturnType &&addServerName(std::string hostname_pattern, SocketContextOptions options = {}) {

Expand Down
2 changes: 2 additions & 0 deletions src/Http3App.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading