Index: trunk/Server/Makefile
===================================================================
--- trunk/Server/Makefile	(revision 5)
+++ trunk/Server/Makefile	(revision 6)
@@ -11,5 +11,5 @@
 
 tewi$(EXEC): $(OBJS) ../Common/common.a
-	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../Common/common.a
+	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) ../Common/common.a -lssl -lcrypto
 
 .c.o:
Index: trunk/Server/config.c
===================================================================
--- trunk/Server/config.c	(revision 5)
+++ trunk/Server/config.c	(revision 6)
@@ -10,30 +10,59 @@
 #include <cm_log.h>
 
-int tw_config_read(const char* path){
+struct tw_config config;
+
+void tw_config_init(void) {}
+
+int tw_config_read(const char* path) {
 	cm_log("Config", "Reading %s", path);
 	char cbuf[2];
 	cbuf[1] = 0;
+	int ln = 0;
 	FILE* f = fopen(path, "r");
-	if(f != NULL){
+	if(f != NULL) {
 		char* line = malloc(1);
 		line[0] = 0;
-		while(1){
+		int stop = 0;
+		char* vhost = NULL;
+		while(stop == 0) {
 			int c = fread(cbuf, 1, 1, f);
-			if(cbuf[0] == '\n' || c <= 0){
+			if(cbuf[0] == '\n' || c <= 0) {
+				ln++;
 				char* l = cm_trim(line);
-				if(strlen(l) > 0 && l[0] != '#'){
+				if(strlen(l) > 0 && l[0] != '#') {
 					char** r = cm_split(l, " \t");
 					int i;
-					if(cm_strcaseequ(r[0], "Include") || cm_strcaseequ(r[0], "IncludeOptional")){
-						for(i = 1; r[i] != NULL; i++){
-							if(tw_config_read(r[i]) != 0 && cm_strcaseequ(r[0], "Include")){
-								for(i = 0; r[i] != NULL; i++) free(r[i]);
-								free(r);
-								free(line);
-								free(l);
-								fclose(f);
-								return 1;
+					if(cm_strcaseequ(r[0], "Include") || cm_strcaseequ(r[0], "IncludeOptional")) {
+						for(i = 1; r[i] != NULL; i++) {
+							if(tw_config_read(r[i]) != 0 && cm_strcaseequ(r[0], "Include")) {
+								stop = 1;
+								break;
 							}
 						}
+					} else if(cm_strcaseequ(r[0], "BeginVirtualHost")) {
+						if(vhost != NULL) {
+							cm_log("Config", "Already in virtual host section");
+							stop = 1;
+						} else {
+							if(r[1] == NULL) {
+								cm_log("Config", "Missing virtual host");
+								stop = 1;
+							} else {
+								vhost = cm_strdup(r[1]);
+							}
+						}
+					} else if(cm_strcaseequ(r[0], "EndVirtualHost")) {
+						if(vhost == NULL) {
+							cm_log("Config", "Not in virtual host section");
+							stop = 1;
+						} else {
+							free(vhost);
+							vhost = NULL;
+						}
+					} else {
+						if(r[0] != NULL) {
+							cm_log("Config", "Unknown directive `%s' at line %d", r[0], ln);
+						}
+						stop = 1;
 					}
 					for(i = 0; r[i] != NULL; i++) free(r[i]);
@@ -45,5 +74,5 @@
 				line[0] = 0;
 				if(c <= 0) break;
-			}else if(cbuf[0] != '\r'){
+			} else if(cbuf[0] != '\r') {
 				char* tmp = line;
 				line = cm_strcat(tmp, cbuf);
@@ -53,6 +82,6 @@
 		free(line);
 		fclose(f);
-		return 0;
-	}else{
+		return stop;
+	} else {
 		cm_log("Config", "Could not open the file");
 		return 1;
Index: trunk/Server/main.c
===================================================================
--- trunk/Server/main.c	(revision 5)
+++ trunk/Server/main.c	(revision 6)
@@ -4,4 +4,6 @@
 #include <stdbool.h>
 #include <string.h>
+
+#include <openssl/opensslv.h>
 
 #include <cm_log.h>
@@ -20,11 +22,11 @@
 				if(!cm_do_log) {
 					cm_do_log = true;
-					cm_log("", "This is Tewi HTTPd, version %s", tw_get_version());
+					cm_log("", "This is Tewi HTTPd, version %s, using %s", tw_get_version(), OPENSSL_VERSION_TEXT);
 				} else {
 					cm_do_log = true;
 				}
-			} else if(strcmp(argv[i], "--config") == 0 || strcmp(argv[i], "-C") == 0){
+			} else if(strcmp(argv[i], "--config") == 0 || strcmp(argv[i], "-C") == 0) {
 				i++;
-				if(argv[i] == NULL){
+				if(argv[i] == NULL) {
 					fprintf(stderr, "Missing argument\n");
 					return 1;
@@ -37,5 +39,6 @@
 		}
 	}
-	if(tw_config_read(config) != 0){
+	tw_config_init();
+	if(tw_config_read(config) != 0) {
 		fprintf(stderr, "Could not read the config\n");
 		return 1;
Index: trunk/Server/tw_config.h
===================================================================
--- trunk/Server/tw_config.h	(revision 5)
+++ trunk/Server/tw_config.h	(revision 6)
@@ -4,4 +4,11 @@
 #define __TW_CONFIG_H__
 
+struct tw_config_entry {};
+
+struct tw_config {
+	struct tw_config_entry root;
+};
+
+void tw_config_init(void);
 int tw_config_read(const char* path);
 
