From 3aee1dbd4b609e8cbe8ecb3f10171f532b030439 Mon Sep 17 00:00:00 2001 From: Nishi Date: Fri, 13 Sep 2024 13:38:57 +0000 Subject: [PATCH] better git-svn-id: file:///raid/svn-personal/tewi/trunk@13 8739d7e6-ffea-ec47-b151-bdff447c6205 --- Server/config.c | 4 ++-- Server/server.c | 2 ++ example.conf | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Server/config.c b/Server/config.c index c70847a..1104a03 100644 --- a/Server/config.c +++ b/Server/config.c @@ -16,7 +16,7 @@ struct tw_config config; struct tw_config_entry* tw_vhost_match(const char* name, int port) { int i; for(i = 0; i < config.vhost_count; i++) { - if(strcmp(config.vhosts[i].name, name) == 0 && config.vhosts[i].port == port) { + if(strcmp(config.vhosts[i].name, name) == 0 && (config.vhosts[i].port == -1 ? 1 : config.vhosts[i].port == port)) { return &config.vhosts[i]; } } @@ -78,7 +78,7 @@ int tw_config_read(const char* path) { current = &config.vhosts[config.vhost_count++]; int i; current->name = cm_strdup(vhost); - current->port = 80; + current->port = -1; for(i = 0; vhost[i] != 0; i++) { if(vhost[i] == ':') { current->name[i] = 0; diff --git a/Server/server.c b/Server/server.c index 9d7d3ff..ef4d475 100644 --- a/Server/server.c +++ b/Server/server.c @@ -127,6 +127,8 @@ unsigned int WINAPI tw_server_pass(void* ptr) { #else void tw_server_pass(int sock, bool ssl, int port) { #endif + char* name = config.hostname; + SSL_CTX* ctx = NULL; SSL* s = NULL; if(ssl) { diff --git a/example.conf b/example.conf index 2d9b0a7..74c4248 100644 --- a/example.conf +++ b/example.conf @@ -7,5 +7,5 @@ ListenSSL 8443 8444 8445 8446 8447 SSLKey key.pem SSLCertificate cert.pem -BeginVirtualHost nishinbsd-ssd:8443 +BeginVirtualHost nishinbsd-ssd EndVirtualHost