Commits

Aristarkh Zagorodnikov committed b560220

Reduced error log thrashing on incomplete configuration

Comments (0)

Files changed (1)

gridfs/mod_gridfs.c

 	int connect_timeout_set;
 	gridfs** gfs_pool;
 	int gfs_pool_count;
+	int incomplete_config;
 } gridfs_config;
 
 struct
     gridfs_config* config = ap_get_module_config(request->per_dir_config, &gridfs_module);
 	if (!config->enabled)
 		return DECLINED;
+	if (config->incomplete_config)
+		return HTTP_INTERNAL_SERVER_ERROR;
     if (request->method_number != M_GET)
 		return HTTP_NOT_IMPLEMENTED;
 	int length = strlen(request->uri);
 	if (!config->db_name)
 	{
 		ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: GridFSDbName is not set."); 
+		config->incomplete_config = 1;
 		return HTTP_INTERNAL_SERVER_ERROR;
 	}
 	if (!config->replica_set_name)
 	{
 		ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: GridFSReplicaSetName is not set."); 
+		config->incomplete_config = 1;
 		return HTTP_INTERNAL_SERVER_ERROR;
 	}
 	if (!config->seeds)
 	{
 		ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: GridFSSeed is not set."); 
+		config->incomplete_config = 1;
 		return HTTP_INTERNAL_SERVER_ERROR;
 	}
 	char* filename = apr_pstrdup(request->pool, request->uri + 1);