1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-09-03 01:21:16 +03:00

Check if an option with the given name exists

This commit is contained in:
bel
2014-02-22 09:34:20 +01:00
parent 55324460ac
commit 96bfe243d5

View File

@@ -199,7 +199,19 @@ static char *sdup(const char *str)
static int set_option(char **options, const char *name, const char *value)
{
int i;
int i, found;
const struct mg_option *default_options = mg_get_valid_options();
found = 0;
for (i = 0; default_options[i].name != 0; i++) {
if (!strcmp(default_options[i].name, name)) {
found = 1;
}
}
if (!found) {
/* unknown option */
return 0;
}
for (i = 0; i < MAX_OPTIONS - 3; i++) {
if (options[i] == NULL) {
@@ -561,42 +573,6 @@ static void *align(void *ptr, DWORD alig)
return ((void *) ul);
}
/*
static int is_boolean_option(const char *option_name)
{
return !strcmp(option_name, "enable_directory_listing") ||
!strcmp(option_name, "enable_keep_alive");
}
static int is_filename_option(const char *option_name)
{
return !strcmp(option_name, "cgi_interpreter") ||
!strcmp(option_name, "global_auth_file") ||
!strcmp(option_name, "put_delete_auth_file") ||
!strcmp(option_name, "access_log_file") ||
!strcmp(option_name, "error_log_file") ||
#ifdef USE_LUA
!strcmp(option_name, "lua_preload_file") ||
#endif
!strcmp(option_name, "ssl_certificate");
}
static int is_directory_option(const char *option_name)
{
return !strcmp(option_name, "document_root") ||
#if defined(USE_WEBSOCKET)
!strcmp(option_name, "websocket_root") ||
#endif
0;
}
static int is_numeric_options(const char *option_name)
{
return !strcmp(option_name, "num_threads") ||
!strcmp(option_name, "request_timeout_ms");
}
*/
static void save_config(HWND hDlg, FILE *fp)
{
char value[2000] = "";