static int ntop_dump_file(lua_State* vm) {
  char *fname;
  FILE *fd;
  struct mg_connection *conn;

  ntop->getTrace()->traceEvent(TRACE_INFO, "%s() called", __FUNCTION__);

  lua_getglobal(vm, CONST_HTTP_CONN);
  if((conn = (struct mg_connection*)lua_touserdata(vm, lua_gettop(vm))) == NULL) {
    ntop->getTrace()->traceEvent(TRACE_ERROR, "INTERNAL ERROR: null HTTP connection");
    return(CONST_LUA_ERROR);
  }

  if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_ERROR);
  if((fname = (char*)lua_tostring(vm, 1)) == NULL)     return(CONST_LUA_PARAM_ERROR);

  ntop->fixPath(fname);
  if((fd = fopen(fname, "r")) != NULL) {
    char tmp[1024];

    ntop->getTrace()->traceEvent(TRACE_INFO, "[HTTP] Serving file %s", fname);

    while((fgets(tmp, sizeof(tmp), fd)) != NULL) {
      char *http_prefix = strstr(tmp, CONST_HTTP_PREFIX_STRING);

      if(http_prefix == NULL) {
	mg_printf(conn, "%s", tmp);
      } else {
	char *begin = tmp;
	int len = strlen(CONST_HTTP_PREFIX_STRING);

	/* Replace CONST_HTTP_PREFIX_STRING with value specified with -Z */
      handle_http_prefix:
	http_prefix[0] = '\0';
	mg_printf(conn, "%s", begin);
	mg_printf(conn, "%s", ntop->getPrefs()->get_http_prefix());
	begin = &http_prefix[len];
	http_prefix = strstr(begin, CONST_HTTP_PREFIX_STRING);

	if(http_prefix != NULL)
	  goto handle_http_prefix;
	else
	  mg_printf(conn, "%s", begin);
      }
    }

    fclose(fd);
    return(CONST_LUA_OK);
  } else {
    ntop->getTrace()->traceEvent(TRACE_INFO, "Unable to read file %s", fname);
    return(CONST_LUA_ERROR);
  }
}
static int ntop_dump_file(lua_State* vm) {
  char *fname;
  FILE *fd;
  struct mg_connection *conn;

  ntop->getTrace()->traceEvent(TRACE_INFO, "%s() called", __FUNCTION__);

  lua_getglobal(vm, CONST_HTTP_CONN);
  if((conn = (struct mg_connection*)lua_touserdata(vm, lua_gettop(vm))) == NULL) {
    ntop->getTrace()->traceEvent(TRACE_ERROR, "INTERNAL ERROR: null HTTP connection");
    return(CONST_LUA_ERROR);
  }

  if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_ERROR);
  if((fname = (char*)lua_tostring(vm, 1)) == NULL)     return(CONST_LUA_PARAM_ERROR);

  ntop->fixPath(fname);
  if((fd = fopen(fname, "r")) != NULL) {
    char tmp[1024];

    ntop->getTrace()->traceEvent(TRACE_INFO, "[HTTP] Serving file %s", fname);

    while((fgets(tmp, sizeof(tmp), fd)) != NULL) {
      char *http_prefix = strstr(tmp, CONST_HTTP_PREFIX_STRING);

      if(http_prefix == NULL) {
	mg_printf(conn, "%s", tmp);
      } else {
	char *begin = tmp;
	int len = strlen(CONST_HTTP_PREFIX_STRING);

	 
      handle_http_prefix:
	http_prefix[0] = '\0';
	mg_printf(conn, "%s", begin);
	mg_printf(conn, "%s", ntop->getPrefs()->get_http_prefix());
	begin = &http_prefix[len];
	http_prefix = strstr(begin, CONST_HTTP_PREFIX_STRING);

	if(http_prefix != NULL)
	  goto handle_http_prefix;
	else
	  mg_printf(conn, "%s", begin);
      }
    }

    fclose(fd);
    return(CONST_LUA_OK);
  } else {
    ntop->getTrace()->traceEvent(TRACE_INFO, "Unable to read file %s", fname);
    return(CONST_LUA_ERROR);
  }
}