Ignore missingServerName if app failed

This commit is contained in:
Alex Hultman
2020-09-04 23:40:37 +02:00
parent f99f20faa9
commit 92b2d2a736
+9 -6
View File
@@ -53,14 +53,17 @@ public:
TemplatedApp &&missingServerName(fu2::unique_function<void(const char *hostname)> handler) {
httpContext->getSocketContextData()->missingServerNameHandler = std::move(handler);
if (!constructorFailed()) {
httpContext->getSocketContextData()->missingServerNameHandler = std::move(handler);
us_socket_context_on_server_name(SSL, (struct us_socket_context_t *) httpContext, [](struct us_socket_context_t *context, const char *hostname) {
us_socket_context_on_server_name(SSL, (struct us_socket_context_t *) httpContext, [](struct us_socket_context_t *context, const char *hostname) {
/* This is the only requirements of being friends with HttpContextData */
HttpContext<SSL> *httpContext = (HttpContext<SSL> *) context;
httpContext->getSocketContextData()->missingServerNameHandler(hostname);
});
}
/* This is the only requirements of being friends with HttpContextData */
HttpContext<SSL> *httpContext = (HttpContext<SSL> *) context;
httpContext->getSocketContextData()->missingServerNameHandler(hostname);
});
return std::move(*this);
}