recognizes listen/listenssl now
git-svn-id: file:///raid/svn-personal/tewi/trunk@7 8739d7e6-ffea-ec47-b151-bdff447c6205
This commit is contained in:
parent
b8c2411b4c
commit
6a90dfd259
|
@ -3,6 +3,7 @@
|
|||
#include "tw_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -11,7 +12,12 @@
|
|||
|
||||
struct tw_config config;
|
||||
|
||||
void tw_config_init(void) {}
|
||||
void tw_config_init(void) {
|
||||
int i;
|
||||
for(i = 0; i < MAX_PORTS + 1; i++) {
|
||||
config.ports[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int tw_config_read(const char* path) {
|
||||
cm_log("Config", "Reading %s", path);
|
||||
|
@ -59,6 +65,16 @@ int tw_config_read(const char* path) {
|
|||
free(vhost);
|
||||
vhost = NULL;
|
||||
}
|
||||
} else if(cm_strcaseequ(r[0], "Listen") || cm_strcaseequ(r[0], "ListenSSL")) {
|
||||
for(i = 1; r[i] != NULL; i++) {
|
||||
uint64_t port = atoi(r[i]);
|
||||
cm_log("Config", "Going to listen at port %d%s", (int)port, cm_strcaseequ(r[0], "ListenSSL") ? " with SSL" : "");
|
||||
if(cm_strcaseequ(r[0], "ListenSSL")) port |= (1ULL << 32);
|
||||
int j;
|
||||
for(j = 0; config.ports[j] != -1; j++)
|
||||
;
|
||||
config.ports[j] = port;
|
||||
}
|
||||
} else {
|
||||
if(r[0] != NULL) {
|
||||
cm_log("Config", "Unknown directive `%s' at line %d", r[0], ln);
|
||||
|
|
|
@ -3,9 +3,15 @@
|
|||
#ifndef __TW_CONFIG_H__
|
||||
#define __TW_CONFIG_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* I don't think you would listen to 1024 ports */
|
||||
#define MAX_PORTS 1024
|
||||
|
||||
struct tw_config_entry {};
|
||||
|
||||
struct tw_config {
|
||||
uint64_t ports[MAX_PORTS + 1]; /* If port & (1 << 32) is non-zero, it is SSL */
|
||||
struct tw_config_entry root;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user