Log a message stating that TLS is disabled if the config requests it.

This commit is contained in:
Jordan Bancino 2023-05-27 17:55:49 +00:00
parent c5cfdb9894
commit 11a7b6653d
1 changed files with 6 additions and 1 deletions

View File

@ -292,17 +292,21 @@ HttpServerCreate(HttpServerConfig * config)
if (!config) if (!config)
{ {
errno = EINVAL;
return NULL; return NULL;
} }
if (!config->handler) if (!config->handler)
{ {
errno = EINVAL;
return NULL; return NULL;
} }
#ifndef TLS_IMPL #ifndef TLS_IMPL
if (config->flags & HTTP_FLAG_TLS) if (config->flags & HTTP_FLAG_TLS)
{ {
Log(LOG_ERR, "TLS support is disabled.");
errno = EINVAL;
return NULL; return NULL;
} }
#endif #endif
@ -318,6 +322,7 @@ HttpServerCreate(HttpServerConfig * config)
server->config = *config; server->config = *config;
server->config.tlsCert = StrDuplicate(config->tlsCert); server->config.tlsCert = StrDuplicate(config->tlsCert);
server->config.tlsKey = StrDuplicate(config->tlsKey); server->config.tlsKey = StrDuplicate(config->tlsKey);
server->sd = -1;
server->threadPool = ArrayCreate(); server->threadPool = ArrayCreate();
if (!server->threadPool) if (!server->threadPool)
@ -396,7 +401,7 @@ error:
ArrayFree(server->threadPool); ArrayFree(server->threadPool);
} }
if (server->sd) if (server->sd > -1)
{ {
close(server->sd); close(server->sd);
} }