Beispiel #1
0
int
mongoosed_main(int argc, char *argv[])
{
   char dflt_port[5] = "80";
#if !defined(NO_AUTH)
   if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'A') {
      if (argc != 6)
         show_usage_and_exit(argv[0]);
      exit(mg_edit_passwords(argv[2], argv[3], argv[4],argv[5]));
   }
#endif /* NO_AUTH */

   if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
      show_usage_and_exit(argv[0]);

#if defined(_WIN32)
   (void) sprintf(service_name, "Mongoose %s", mg_version());
   try_to_run_as_nt_service();
#endif /* _WIN32 */

#ifndef _WIN32
   (void) signal(SIGCHLD, signal_handler);
#endif /* _WIN32 */

   (void) signal(SIGTERM, signal_handler);
   (void) signal(SIGINT, signal_handler);

   if ((ctx = mg_start()) == NULL) {
      (void) printf("%s\n", "Cannot initialize Mongoose context");
      exit(EXIT_FAILURE);
   }

   process_command_line_arguments(ctx, argv);
   if (mg_get_option(ctx, "ports") == NULL &&
       mg_set_option(ctx, "ports", dflt_port /*"8080"*/) != 1)
      exit(EXIT_FAILURE);

   printf("Mongoose %s started on port(s) [%s], serving directory [%s]\n",
          mg_version(),
          mg_get_option(ctx, "ports"),
          mg_get_option(ctx, "root"));
   fflush(stdout);
   while (exit_flag == 0)
      sleep(1);

   (void) printf("Exiting on signal %d, "
                 "waiting for all threads to finish...", exit_flag);
   fflush(stdout);
   mg_stop(ctx);
   (void) printf("%s", " done.\n");

   return (EXIT_SUCCESS);
}
Beispiel #2
0
int main(int argc, char **argv)
{
    printf("rtvd %s\n", RTVD_VERSION);

    char *port = "8080";

    if (argc > 1)
        port = argv[1];

    char *webPath   = malloc(128);
    strcpy(webPath,"./"); 
    //if (get_conf_string("System", "WebServerPath", webPath) != RETURN_SUCCESS) {
    //    mg_set_option(ctx, "root", "./www");
   // } else {
    mg_set_option(ctx, "root", webPath);
   // }
    mg_set_option(ctx, "ports", port);
    //Test_InPutTs();
    mg_bind_to_uri(ctx, "/test", &show_post, "7");
    mg_bind_to_uri(ctx, "/stati", &stati_handler, "8");
    mg_bind_to_uri(ctx, "/s", &stream_page_handler, "9");
    mg_bind_to_uri(ctx, "/si", &stream_info_handler, "10");
    mg_bind_to_uri(ctx, "/ss", &stream_static_handler, "11");
    mg_bind_to_uri(ctx, "/pcr", &stream_pcr_handler, "12");
    mg_bind_to_uri(ctx, "/ajax/start_flow", &stream_start_flow_handler, "13");
    mg_bind_to_uri(ctx, "/ajax/stop_flow", &stream_stop_flow_handler, "14");

    mg_bind_to_error_code(ctx, 404, &test_error, NULL);
    ctx = mg_start();
    printf("Mongoose %s started on port(s) [%s], serving directory [%s]\n",
            mg_version(),
            mg_get_option(ctx, "listening_ports"),
            mg_get_option(ctx, "root"));
    while (1) {sleep(1);}
}
Beispiel #3
0
static int ntop_get_info(lua_State* vm) {
  char rsp[256];
  int major, minor, patch;

  lua_newtable(vm);
  lua_push_str_table_entry(vm, "copyright", (char*)"© 1998-2013 - ntop.org");
  lua_push_str_table_entry(vm, "authors", (char*)"Luca Deri and Alfredo Cardigliano");
  lua_push_str_table_entry(vm, "license", (char*)"GNU GPLv3");
  snprintf(rsp, sizeof(rsp), "%s (%s)", PACKAGE_VERSION, NTOPNG_SVN_RELEASE);
  lua_push_str_table_entry(vm, "version", rsp);
  lua_push_int_table_entry(vm, "uptime", ntop->getGlobals()->getUptime());
  lua_push_str_table_entry(vm, "version.rrd", rrd_strversion());
  lua_push_str_table_entry(vm, "version.redis", ntop->getRedis()->getVersion(rsp, sizeof(rsp)));
  lua_push_str_table_entry(vm, "version.httpd", (char*)mg_version());
  lua_push_str_table_entry(vm, "version.luajit", (char*)LUAJIT_VERSION);
#ifdef HAVE_GEOIP
  lua_push_str_table_entry(vm, "version.geoip", (char*)GeoIP_lib_version());
#endif
  lua_push_str_table_entry(vm, "version.ndpi", ndpi_revision());

  zmq_version(&major, &minor, &patch);
  snprintf(rsp, sizeof(rsp), "%d.%d.%d", major, minor, patch);
  lua_push_str_table_entry(vm, "version.zmq", rsp);

  return(CONST_LUA_OK);
}
Beispiel #4
0
int
main_ztv_webui_init(int argc, char *argv[])
{
	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'A') {
		if (argc != 6)
			show_usage_and_exit();
		exit(mg_edit_passwords(argv[2], argv[3], argv[4],argv[5]));
	}

	if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
		show_usage_and_exit();

#ifndef _WIN32
	(void) signal(SIGCHLD, signal_handler);
#endif /* _WIN32 */
	(void) signal(SIGTERM, signal_handler);
	(void) signal(SIGINT, signal_handler);

	if ((ctx = mg_start()) == NULL) {
		(void) printf("%s\n", "Cannot initialize Mongoose context");
		exit(EXIT_FAILURE);
	}

	process_command_line_arguments(ctx, argv);
	if (mg_get_option(ctx, "ports") == NULL &&
	    mg_set_option(ctx, "ports", "8080") != 1)
		exit(EXIT_FAILURE);

	printf("Mongoose %s started on port(s) [%s], serving directory [%s]\n",
	    mg_version(),
	    mg_get_option(ctx, "ports"),
	    mg_get_option(ctx, "root"));

    mg_set_uri_callback(ctx, "/login", &login_page, NULL);
    mg_set_uri_callback(ctx, "/ztv", &ztv_page, NULL);
    mg_set_uri_callback(ctx, "/share.apk", &share_pkg,NULL);
    mg_set_uri_callback(ctx, "/shs", &shs_page, NULL);
    mg_set_uri_callback(ctx, "/about", &shs_page, NULL);
    mg_set_uri_callback(ctx, "/uploadfile", &upload_page, NULL);
    mg_set_uri_callback(ctx, "/upload.html", &upload_input_page, NULL);
    mg_set_uri_callback(ctx, "/upload.htm", &upload_input_page, NULL);    
    mg_set_uri_callback(ctx, "/r.html", &rili_page, NULL);
    mg_set_uri_callback(ctx, "/r.manifest", &r_manifest_page, NULL);        
    mg_set_uri_callback(ctx, "/http302Jobs.mp4", &http302Jobs_mp4_page, NULL);  
    mg_set_uri_callback(ctx, "/bbs.html", &bbs_input_page, NULL);  
    mg_set_uri_callback(ctx, "/bbs", &bbs_page, NULL);

	fflush(stdout);
/*	while (exit_flag == 0)
		sleep(1);

	(void) printf("Exiting on signal %d, "
	    "waiting for all threads to finish...", exit_flag);
	fflush(stdout);
	mg_stop(ctx);
	(void) printf("%s", " done.\n");   */

	return (EXIT_SUCCESS);
}
Beispiel #5
0
int main (int argc, const char * argv[])
{
	helper_num = 0;
    helper1 = 0;
    helper2 = 0;
    helper3 = 0;
    SN1_par = 100;
    SN2_par = 100;
    SN3_par = 100;
    
	struct mg_context	*ctx; 
		
	(void) signal(SIGTERM, signal_handler);
	(void) signal(SIGINT, signal_handler);
	
	if ((ctx = mg_start()) == NULL) {
		(void) printf("%s\n", "Cannot initialize Mongoose context");
		exit(EXIT_FAILURE);
	}
	
	mg_set_option(ctx, "ports", "9909");	
	mg_set_option(ctx, "max_threads", "10");
	mg_set_option(ctx, "dir_list", "no");   // Disable directory listing
	
	mg_set_uri_callback(ctx, "/*", get, NULL);  // Setting callback handler.
	
	printf("Mongoose %s started on port(s) [%s], serving directory [%s]\n",
		   mg_version(),
		   mg_get_option(ctx, "ports"),
		   mg_get_option(ctx, "root"));
	
	fflush(stdout); 
	getchar();
	exit_flag = 9;
	
	(void) printf("Exiting on signal %d, "
				  "waiting for all threads to finish...", exit_flag);
	fflush(stdout);
	mg_stop(ctx);
	
	(void) printf("%s", " done.\n");
	
	return (EXIT_SUCCESS);	
}
Beispiel #6
0
static void show_usage_and_exit(void) {
  const char **names;
  int i;

  fprintf(stderr, "Mongoose version %s (c) Sergey Lyubka, built %s\n",
          mg_version(), __DATE__);
  fprintf(stderr, "Usage:\n");
  fprintf(stderr, "  mongoose -A <htpasswd_file> <realm> <user> <passwd>\n");
  fprintf(stderr, "  mongoose <config_file>\n");
  fprintf(stderr, "  mongoose [-option value ...]\n");
  fprintf(stderr, "\nOPTIONS:\n");

  names = mg_get_valid_option_names();
  for (i = 0; names[i] != NULL; i += 3) {
    fprintf(stderr, "  -%s %s (default: \"%s\")\n",
            names[i], names[i + 1], names[i + 2] == NULL ? "" : names[i + 2]);
  }
  exit(EXIT_FAILURE);
}
Beispiel #7
0
static void show_usage_and_exit(void) {
  const char **names;
  int i;

  fprintf(stderr, "Civetweb v%s, built on %s\n",
          mg_version(), __DATE__);
  fprintf(stderr, "Usage:\n");
  fprintf(stderr, "  civetweb -A <htpasswd_file> <realm> <user> <passwd>\n");
  fprintf(stderr, "  civetweb [config_file]\n");
  fprintf(stderr, "  civetweb [-option value ...]\n");
  fprintf(stderr, "\nOPTIONS:\n");

  names = mg_get_valid_option_names();
  for (i = 0; names[i] != NULL; i += 2) {
    fprintf(stderr, "  -%s %s\n",
            names[i], names[i + 1] == NULL ? "<empty>" : names[i + 1]);
  }
  exit(EXIT_FAILURE);
}
Beispiel #8
0
void ofxWebServer::start(const char** options)
{	
	ctx = mg_start(NULL,options);     // Start Mongoose serving thread
	
	if (ctx == NULL) {
		(void) printf("%s\n", "Cannot initialize Mongoose context");
		exit(EXIT_FAILURE);
	}
	
	printf("Mongoose %s web server started on port(s) %s with web root [%s]\n",
		   mg_version(), mg_get_option(ctx, "listening_ports"),
		   mg_get_option(ctx, "document_root"));
	
	/*#ifdef MACOSX
		mg_set_option(ctx, "cgi_interp", ofToDataPath("php/php-cgi").c_str());
	#endif*/
	
//	TODOmg_set_error_callback(ctx, 404, ccwServer::show404, NULL);
//	TODOmg_set_error_callback(ctx, 403, ccwServer::show403, NULL);
}
Beispiel #9
0
static void show_usage_and_exit(void) {
  const char **names;
  int i;

  fprintf(stderr, "Mongoose version %s (c) Sergey Lyubka\n", mg_version());
  fprintf(stderr, "Usage:\n");
  fprintf(stderr, "  mongoose -A <htpasswd_file> <realm> <user> <passwd>\n");
  fprintf(stderr, "  mongoose <config_file>\n");
  fprintf(stderr, "  mongoose [-option value ...]\n");
  fprintf(stderr, "OPTIONS:\n");

  names = mg_get_valid_option_names();
  for (i = 0; names[i] != NULL; i += 3) {
    fprintf(stderr, "  -%s %s (default: \"%s\")\n",
            names[i], names[i + 1], names[i + 2] == NULL ? "" : names[i + 2]);
  }
  fprintf(stderr, "See  http://code.google.com/p/mongoose/wiki/MongooseManual"
          " for more details.\n");
  fprintf(stderr, "Example:\n  mongoose -s cert.pem -p 80,443s -d no\n");
  exit(EXIT_FAILURE);
}
Beispiel #10
0
/*
 * Show usage string and exit.
 */
static void
show_usage_and_exit(const char *prog)
{
   const struct mg_option  *o;

   (void) fprintf(stderr,
                  "Mongoose version %s (c) Sergey Lyubka\n"
                  "usage: %s [options] [config_file]\n", mg_version(), prog);

#if !defined(NO_AUTH)
   fprintf(stderr, "  -A <htpasswd_file> <realm> <user> <passwd>\n");
#endif /* NO_AUTH */

   o = mg_get_option_list();
   for (; o->name != NULL; o++) {
      (void) fprintf(stderr, "  -%s\t%s", o->name, o->description);
      if (o->default_value != NULL)
         fprintf(stderr, " (default: \"%s\")", o->default_value);
      fputc('\n', stderr);
   }
   exit(EXIT_FAILURE);
}
Beispiel #11
0
static void show_usage_and_exit(const struct mg_context *ctx) {
  const char **names;
  int i;

  fprintf(stderr, "Mongoose version %s (c) Sergey Lyubka, built %s\n",
          mg_version(), __DATE__);
  fprintf(stderr, "Usage:\n");
  fprintf(stderr, "  mongoose -A <htpasswd_file> <realm> <user> <passwd>\n");
  fprintf(stderr, "  mongoose <config_file>\n");
  fprintf(stderr, "  mongoose [-option value ...]\n");
  fprintf(stderr, "\nOPTIONS:\n");

  names = mg_get_valid_option_names();
  for (i = 0; names[i] != NULL; i += MG_ENTRIES_PER_CONFIG_OPTION) {
    fprintf(stderr, "  %s%s %s (default: \"%s\")\n",
            (names[i][0] ? "-" : "  "),
            names[i], names[i + 1], names[i + 2] == NULL ? "" : names[i + 2]);
  }
  fprintf(stderr, "\nSee  http://code.google.com/p/mongoose/wiki/MongooseManual"
          " for more details.\n");
  fprintf(stderr, "Example:\n  mongoose -s cert.pem -p 80,443s -d no\n");
  exit(EXIT_FAILURE);
}
Beispiel #12
0
/*
 * This callback function is attached to the "/" and "/abc.html" URIs,
 * thus is acting as "index.html" file. It shows a bunch of links
 * to other URIs, and allows to change the value of program's
 * internal variable. The pointer to that variable is passed to the
 * callback function as arg->user_data.
 */
static void
show_index(struct mg_connection *conn,
		const struct mg_request_info *request_info,
		void *user_data)
{
	char		*value;
	const char	*host;

	/* Change the value of integer variable */
	value = mg_get_var(conn, "name1");
	if (value != NULL) {
		* (int *) user_data = atoi(value);
		free(value);

		/*
		 * Suggested by Luke Dunstan. When POST is used,
		 * send 303 code to force the browser to re-request the
		 * page using GET method. This prevents the possibility of
		 * the user accidentally resubmitting the form when using
		 * Refresh or Back commands in the browser.
		 */
		if (!strcmp(request_info->request_method, "POST")) {
			(void) mg_printf(conn, "HTTP/1.1 303 See Other\r\n"
				"Location: %s\r\n\r\n", request_info->uri);
			return;
		}
	}

	mg_printf(conn, "%s",
		"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"
		"<html><body><h1>Welcome to embedded example of Mongoose");
#if 0

	mg_printf(conn, " v. %s </h1><ul>", mg_version());

	mg_printf(conn, "<li><code>REQUEST_METHOD: %s "
	    "REQUEST_URI: \"%s\" QUERY_STRING: \"%s\""
	    " REMOTE_ADDR: %lx REMOTE_USER: \"(null)\"</code><hr>",
	    request_info->request_method, request_info->uri,
	    request_info->query_string ? request_info->query_string : "(null)",
	    request_info->remote_ip);
	mg_printf(conn, "<li>Internal int variable value: <b>%d</b>",
			* (int *) user_data);

	mg_printf(conn, "%s",
		"<form method=\"GET\">Enter new value: "
		"<input type=\"text\" name=\"name1\"/>"
		"<input type=\"submit\" value=\"set new value using GET method\"></form>");
	mg_printf(conn, "%s",
		"<form method=\"POST\">Enter new value: "
		"<input type=\"text\" name=\"name1\"/>"
		"<input type=\"submit\" "
		"value=\"set new value using POST method\"></form>");
		
		mg_printf(conn, "%s",
		"<li><a href=\"/Makefile\">Regular file (Makefile)</a><hr>"
		"<li><a href=\"/ssi_test.shtml\">SSI file "
			"(ssi_test.shtml)</a><hr>"
		"<li><a href=\"/users/joe/\">Wildcard URI example</a><hr>"
		"<li><a href=\"/not-existent/\">Custom 404 handler</a><hr>");

	host = mg_get_header(conn, "Host");
	mg_printf(conn, "<li>'Host' header value: [%s]<hr>",
	    host ? host : "NOT SET");
#endif

	mg_printf(conn, "<li>Upload file example. "
	    "<form method=\"post\" enctype=\"multipart/form-data\" "
	    "action=\"/post\"><input type=\"file\" name=\"file\">"
	    "<input type=\"submit\"></form>");

	mg_printf(conn, "%s", "</body></html>");
}
Beispiel #13
0
static void init_server_name(void) {
  snprintf(server_name, sizeof(server_name), "Mongoose web server v. %s",
           mg_version());
}
Beispiel #14
0
bool StartWebServer() {
    //LOG_INFO << "Starting Mongoose " << mg_version() << " web server";
    qDebug() << "Starting Mongoose " << mg_version() << " web server";

    ////json_value* appSettings = GetApplicationSettings();

    // 404_handler
    ////std::string _404_handler = (*appSettings)["web_server"]["404_handler"];
    std::string _404_handler = "/pretty-urls.php";

    // Ip address and port. If port was set to 0, then real port
    // will be known only after the webserver was started.
    ////std::string ipAddress = (*appSettings)["web_server"]["listen_on"][0];
    std::string ipAddress = "127.0.0.1";
    ////std::string port = (*appSettings)["web_server"]["listen_on"][1];
    std::string port = "8080";
#if 0x0
    long portInt = (*appSettings)["web_server"]["listen_on"][1];
    if (portInt)
        port = IntToString(portInt);
    if (ipAddress.empty()) {
        ipAddress = "127.0.0.1";
    }
    if (port.empty()) {
        port = "0";
    }
#endif

    // WWW directory from settings.
#if 0x0
    std::string wwwDirectory = (*appSettings)["web_server"]["www_directory"];
    if (wwwDirectory.empty()) {
        wwwDirectory = "www";
    }
    wwwDirectory = GetAbsolutePath(wwwDirectory);
#else
    std::string wwwDirectory = "E:\\phpdesktop-chrome-31.8-php-5.6.1\\www";
#endif
    //LOG_INFO << "WWW directory: " << wwwDirectory;
    qDebug() << "WWW directory: " << wwwDirectory;

    // Index files from settings.
#if 0x0
    const json_value indexFilesArray = (*appSettings)["web_server"]["index_files"];
    std::string indexFiles;
    for (int i = 0; i < 32; i++) {
        const char* file = indexFilesArray[i];
        if (strlen(file)) {
            if (indexFiles.length())
                indexFiles.append(",");
            indexFiles.append(file);
        }
    }
    if (indexFiles.empty())
        indexFiles = "index.html,index.php";
#else
    std::string indexFiles = "index.html,index.php";
#endif
    //LOG_INFO << "Index files: " << indexFiles;
    qDebug() << "Index files: " << indexFiles;

    // CGI interpreter from settings.
#if 0x0
    std::string cgiInterpreter = (*appSettings)["web_server"]["cgi_interpreter"];
    if (cgiInterpreter.empty()) {
        cgiInterpreter = "php\\php-cgi.exe";
    }
    cgiInterpreter = GetAbsolutePath(cgiInterpreter);
#else
    std::string cgiInterpreter = "E:\\phpdesktop-chrome-31.8-php-5.6.1\\php\\php-cgi.exe";
#endif
    //LOG_INFO << "CGI interpreter: " << cgiInterpreter;
    qDebug() << "CGI interpreter: " << cgiInterpreter;

    // CGI extensions from settings.
#if 0x0
    const json_value cgiExtensions =
            (*appSettings)["web_server"]["cgi_extensions"];
    std::string cgiPattern;
    for (int i = 0; i < 32; i++) {
        const char* extension = cgiExtensions[i];
        if (strlen(extension)) {
            if (cgiPattern.length())
                cgiPattern.append("|");
            cgiPattern.append("**.").append(extension).append("$");
        }
    }
    if (cgiPattern.empty())
        cgiPattern = "**.php$";
#else
    std::string cgiPattern = "**.php$";
#endif
    //LOG_INFO << "CGI pattern: " << cgiPattern;
    qDebug() << "CGI pattern: " << cgiPattern;

    // Hide files patterns.
#if 0x0
    const json_value hide_files = (*appSettings)["web_server"]["hide_files"];
    std::string hide_files_patterns = "";
    for (int i = 0; i < 100; i++) {
        const char* pattern = hide_files[i];
        if (strlen(pattern)) {
            if (hide_files_patterns.length())
                hide_files_patterns.append("|");
            hide_files_patterns.append("**/").append(pattern).append("$");
        }
    }
#else
    std::string hide_files_patterns = "";
#endif
    //LOG_INFO << "Hide files patterns: " << hide_files_patterns;
    qDebug() << "Hide files patterns: " << hide_files_patterns;

    // Temp directory.
    ////std::string cgi_temp_dir = (*appSettings)["web_server"]["cgi_temp_dir"];
    ////cgi_temp_dir = GetAbsolutePath(cgi_temp_dir);
    std::string cgi_temp_dir = "";
    QDir cgi_temp_dir_q(QString::fromStdString(cgi_temp_dir));
    ////if (!cgi_temp_dir.length() || !DirectoryExists(cgi_temp_dir)) {
    if (!cgi_temp_dir.length() || !cgi_temp_dir_q.exists()) {
        if (cgi_temp_dir.length()) {
            //LOG_WARNING << "cgi_temp_dir directory does not exist: " << cgi_temp_dir;
            qDebug() << "cgi_temp_dir directory does not exist: " << cgi_temp_dir;
        }
        ////cgi_temp_dir.assign(GetAnsiTempDirectory());
        cgi_temp_dir = QDir::tempPath().toStdString();
    }

    // CGI environment variables.
    std::string cgiEnvironment = "";
    cgiEnvironment.append("TMP=").append(cgi_temp_dir).append(",");
    cgiEnvironment.append("TEMP=").append(cgi_temp_dir).append(",");
    cgiEnvironment.append("TMPDIR=").append(cgi_temp_dir).append(",");
    // Mongoose sets SERVER_NAME to "mydomain.com"
    cgiEnvironment.append("SERVER_NAME=").append(ipAddress).append(",");
#if 0x0
    // Let users identify whether web app runs in a normal browser
    // or a phpdesktop browser.
    cgiEnvironment.append("PHPDESKTOP_VERSION=").append(GetPhpDesktopVersion());
    // Environment from application args
    if (g_cgiEnvironmentFromArgv.length()) {
        cgiEnvironment.append(",").append(g_cgiEnvironmentFromArgv);
    }
#endif
    //LOG_INFO << "CGI environment variables set: " << cgiEnvironment;
    qDebug() << "CGI environment variables set: " << cgiEnvironment;

    // Mongoose web server.
    std::string listening_ports = ipAddress + ":" + port;
    const char* options[] = {
        "document_root", wwwDirectory.c_str(),
        "listening_ports", listening_ports.c_str(),
        "index_files", indexFiles.c_str(),
        "cgi_interpreter", cgiInterpreter.c_str(),
        "cgi_pattern", cgiPattern.c_str(),
        "cgi_environment", cgiEnvironment.c_str(),
        "404_handler", _404_handler.c_str(),
        "hide_files_patterns", hide_files_patterns.c_str(),
        NULL
    };

    // Globals.
    g_wwwDirectory = wwwDirectory;
    g_cgiInterpreter = cgiInterpreter;

    mg_callbacks callbacks = {0};
    callbacks.log_message = &log_message;
    callbacks.end_request = &end_request;
    g_mongooseContext = mg_start(&callbacks, NULL, options);
    if (g_mongooseContext == NULL)
        return false;

    // When port was set to 0 then a random free port was assigned.
    g_webServerPort = mg_get_listening_port(g_mongooseContext);
    g_webServerIpAddress = ipAddress;
    g_webServerUrl = "http://" + ipAddress + ":" + std::to_string(g_webServerPort) + "/";
    //LOG_INFO << "Web server url: " << g_webServerUrl;
    qDebug() << "Web server url: " << g_webServerUrl;

    return true;
}
Beispiel #15
0
static void init_server_name(void) {
  snprintf(server_name, sizeof(server_name), "Civetweb v%s",
           mg_version());
}
Beispiel #16
0
static void init_server_name(void) {
  snprintf(server_name, sizeof(server_name), "EST server v. %s",
           mg_version());
}