Explorar o código

Add test for multidomain support

bel2125 %!s(int64=7) %!d(string=hai) anos
pai
achega
ba36d5e1ec

+ 6 - 0
Makefile

@@ -83,6 +83,7 @@ ifdef WITH_ALL
   WITH_LUA = 1
   WITH_DUKTAPE = 1
   WITH_SERVER_STATS = 1
+  WITH_EXPERIMENTAL = 1
   #WITH_CPP is not defined, ALL means only real features, not wrappers
 endif
 
@@ -112,6 +113,10 @@ ifdef WITH_DUKTAPE
   include resources/Makefile.in-duktape
 endif
 
+ifdef WITH_EXPERIMENTAL
+  CFLAGS += -DMG_EXPERIMENTAL_INTERFACES
+endif
+
 ifdef WITH_IPV6
   CFLAGS += -DUSE_IPV6
 endif
@@ -201,6 +206,7 @@ help:
 	@echo "   WITH_WEBSOCKET=1      build with web socket support"
 	@echo "   WITH_SERVER_STATS=1   build includes support for server statistics"
 	@echo "   WITH_CPP=1            build library with c++ classes"
+	@echo "   WITH_EXPERIMENTAL=1   build with experimental features"
 	@echo "   CONFIG_FILE=file      use 'file' as the config file"
 	@echo "   CONFIG_FILE2=file     use 'file' as the backup config file"
 	@echo "   DOCUMENT_ROOT=/path   document root override when installing"

+ 3 - 0
examples/multidomain/README.md

@@ -0,0 +1,3 @@
+Compile civetweb to the repository root and run
+./civetweb examples/multidomain/base_domain.conf
+

+ 5 - 0
examples/multidomain/add_domain.conf

@@ -0,0 +1,5 @@
+ssl_certificate resources/cert/server_bkup.pem
+authentication_domain localhost
+document_root test/ajax/
+enable_directory_listing no
+

+ 7 - 0
examples/multidomain/base_domain.conf

@@ -0,0 +1,7 @@
+listening_ports 80r,443s
+ssl_certificate resources/cert/server.pem
+authentication_domain default
+add_domain examples/multidomain/add_domain.conf
+document_root test
+enable_directory_listing yes
+

+ 3 - 3
src/main.c

@@ -562,7 +562,7 @@ set_option(char **options, const char *name, const char *value)
 		if (!strcmp(name, main_config_options[OPTION_ADD_DOMAIN].name)) {
 			if (g_num_add_domains > 0) {
 				g_add_domain =
-				    (const char **)realloc(g_add_domain,
+				    (const char **)realloc((void *)g_add_domain,
 				                           sizeof(char *)
 				                               * (g_num_add_domains + 1));
 				if (!g_add_domain) {
@@ -698,7 +698,7 @@ read_config_file(const char *config_file, char **options)
 
 	/* Load config file settings first */
 	if (fp != NULL) {
-		fprintf(stderr, "Loading config file %s\n", config_file);
+		fprintf(stdout, "Loading config file %s\n", config_file);
 
 		/* Loop over the lines in config file */
 		while (fgets(line, sizeof(line), fp) != NULL) {
@@ -2721,7 +2721,7 @@ WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 	case WM_CREATE:
 		if ((__argv[1] != NULL) && !strcmp(__argv[1], service_magic_argument)) {
 			static SERVICE_TABLE_ENTRY service_table[2];
-			char buf *service_argv[2];
+			char *service_argv[2];
 
 			service_argv[0] = __argv[0];
 			service_argv[1] = NULL;