Fix TLS code review issues: SSL cleanup, TLS 1.2 min, CA verify, deprecation guards, server --help, port validation, __thread io_ssl, shared accept loop

This commit is contained in:
2026-07-16 16:56:33 +02:00
parent eff50346fd
commit 864eb1316d
10 changed files with 167 additions and 87 deletions
+10 -1
View File
@@ -2,6 +2,7 @@
#include "config.h"
#include "log.h"
#include "protocol.h"
#include "transport_tls.h"
#include "utils.h"
#include <errno.h>
#include <limits.h>
@@ -50,7 +51,7 @@ static void print_usage(void) {
printf(" --tls Enable TLS encryption\n");
printf(" --cert <path> TLS certificate file (PEM)\n");
printf(" --key <path> TLS private key file (PEM)\n");
printf(" --ca <path> CA certificate for verification (PEM)\n");
printf(" --ca <path> TLS CA certificate file (PEM)\n");
printf(" --help Show this help\n");
}
@@ -230,6 +231,14 @@ int main(int argc, char *argv[]) {
config->use_metadata = true;
}
if (config->use_tls) {
if (!config->tls_cert || !config->tls_key) {
fprintf(stderr, "Error: --tls requires --cert and --key\n");
return 1;
}
tls_global_init();
}
if (config->use_multithreading)
return send_files_multithreaded(config);
return send_files(config);