From 11a7b6653d1bf247549521bdccef77ecadfbd737 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Sat, 27 May 2023 17:55:49 +0000 Subject: [PATCH] Log a message stating that TLS is disabled if the config requests it. --- src/HttpServer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/HttpServer.c b/src/HttpServer.c index 78009f7..5913a2d 100644 --- a/src/HttpServer.c +++ b/src/HttpServer.c @@ -292,17 +292,21 @@ HttpServerCreate(HttpServerConfig * config) if (!config) { + errno = EINVAL; return NULL; } if (!config->handler) { + errno = EINVAL; return NULL; } #ifndef TLS_IMPL if (config->flags & HTTP_FLAG_TLS) { + Log(LOG_ERR, "TLS support is disabled."); + errno = EINVAL; return NULL; } #endif @@ -318,6 +322,7 @@ HttpServerCreate(HttpServerConfig * config) server->config = *config; server->config.tlsCert = StrDuplicate(config->tlsCert); server->config.tlsKey = StrDuplicate(config->tlsKey); + server->sd = -1; server->threadPool = ArrayCreate(); if (!server->threadPool) @@ -396,7 +401,7 @@ error: ArrayFree(server->threadPool); } - if (server->sd) + if (server->sd > -1) { close(server->sd); }