Index: trunk/Manpage/tewi.conf.5.tmpl
===================================================================
--- trunk/Manpage/tewi.conf.5.tmpl	(revision 122)
+++ trunk/Manpage/tewi.conf.5.tmpl	(revision 123)
@@ -19,4 +19,6 @@
 .It Pa "LoadModule"
 Loads the module.
+.It Pa "HidePort" "ShowPort"
+Shows/Hides the port in directory listing, and the default error page.
 .It Pa "MIMEType"
 Specifies the MIME type for files.
Index: trunk/Server/config.c
===================================================================
--- trunk/Server/config.c	(revision 122)
+++ trunk/Server/config.c	(revision 123)
@@ -85,4 +85,5 @@
 	config.root.index_count = 0;
 	config.root.readme_count = 0;
+	config.root.hideport = 0;
 	config.vhost_count = 0;
 	config.module_count = 0;
@@ -186,4 +187,5 @@
 								current->index_count = 0;
 								current->readme_count = 0;
+								current->hideport = -1;
 								int i;
 								current->name = cm_strdup(vhost);
@@ -217,4 +219,8 @@
 							config.ports[j] = port;
 						}
+					} else if(cm_strcaseequ(r[0], "HidePort")) {
+						current->hideport = 1;
+					} else if(cm_strcaseequ(r[0], "ShowPort")) {
+						current->hideport = 0;
 					} else if(cm_strcaseequ(r[0], "SSLKey")) {
 						if(r[1] == NULL) {
Index: trunk/Server/server.c
===================================================================
--- trunk/Server/server.c	(revision 122)
+++ trunk/Server/server.c	(revision 123)
@@ -285,7 +285,12 @@
 }
 
-char* tw_http_default_error(int code, char* name, int port) {
+char* tw_http_default_error(int code, char* name, int port, struct tw_config_entry* vhost) {
 	char address[1024];
-	sprintf(address, "<address>%s Server at %s Port %d</address>", tw_server, name, port);
+
+	if((vhost->hideport == -1 ? config.root.hideport : vhost->hideport) == 1) {
+		sprintf(address, "<address>%s Server at %s</address>", tw_server, name, port);
+	} else {
+		sprintf(address, "<address>%s Server at %s Port %d</address>", tw_server, name, port);
+	}
 
 	char* st = cm_strdup(tw_http_status(code));
@@ -306,6 +311,6 @@
 }
 
-void tw_http_error(SSL* ssl, int sock, int error, char* name, int port) {
-	char* str = tw_http_default_error(error, name, port);
+void tw_http_error(SSL* ssl, int sock, int error, char* name, int port, struct tw_config_entry* vhost) {
+	char* str = tw_http_default_error(error, name, port, vhost);
 	tw_process_page(ssl, sock, tw_http_status(error), "text/html", NULL, str, strlen(str), 0, 0);
 	free(str);
@@ -526,5 +531,5 @@
 				}
 				if(co == _TW_MODULE_ERROR) {
-					tw_http_error(s, sock, (ret & 0xffff00) >> 8, name, port);
+					tw_http_error(s, sock, (ret & 0xffff00) >> 8, name, port, vhost_entry);
 					break;
 				}
@@ -566,5 +571,5 @@
 			if(!rej && stat(path, &st) == 0) {
 				if(!tw_permission_allowed(path, addr, req, vhost_entry)) {
-					tw_http_error(s, sock, 403, name, port);
+					tw_http_error(s, sock, 403, name, port, vhost_entry);
 				} else if(S_ISDIR(st.st_mode)) {
 					if(req.path[strlen(req.path) - 1] != '/') {
@@ -738,5 +743,10 @@
 							}
 							addstring(&str, "		<hr>\n");
-							addstring(&str, "		<address>%s Server at %s Port %d</address>\n", tw_server, name, port);
+							int hp = vhost_entry->hideport == -1 ? config.root.hideport : vhost_entry->hideport;
+							if(hp == 0) {
+								addstring(&str, "		<address>%s Server at %s Port %d</address>\n", tw_server, name, port);
+							} else {
+								addstring(&str, "		<address>%s Server at %s</address>\n", tw_server, name, port);
+							}
 							addstring(&str, "	</body>\n");
 							addstring(&str, "</html>\n");
@@ -762,5 +772,5 @@
 				}
 			} else {
-				tw_http_error(s, sock, 404, name, port);
+				tw_http_error(s, sock, 404, name, port, vhost_entry);
 			}
 			free(path);
@@ -770,5 +780,5 @@
 	} else if(ret == -1) {
 	} else {
-		tw_http_error(s, sock, 400, name, port);
+		tw_http_error(s, sock, 400, name, port, &config.root);
 	}
 	tw_free_request(&req);
Index: trunk/Server/tw_config.h
===================================================================
--- trunk/Server/tw_config.h	(revision 122)
+++ trunk/Server/tw_config.h	(revision 123)
@@ -61,4 +61,5 @@
 	char* sslcert;
 	char* root;
+	int hideport;
 	struct tw_dir_entry dirs[MAX_DIRS];
 	int dir_count;
Index: trunk/Server/tw_version.h
===================================================================
--- trunk/Server/tw_version.h	(revision 122)
+++ trunk/Server/tw_version.h	(revision 123)
@@ -4,5 +4,5 @@
 #define __TW_VERSION_H__
 
-#define TW_VERSION "1.02A\0"
+#define TW_VERSION "1.03\0"
 
 const char* tw_get_version(void);
