Deleted
Added
nxt_conf_validation.c (966:572e2c05aa96) | nxt_conf_validation.c (977:4f9268f27b57) |
---|---|
1 2/* 3 * Copyright (C) Valentin V. Bartenev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#include <nxt_main.h> 8#include <nxt_conf.h> --- 74 unchanged lines hidden (view full) --- 83static nxt_int_t nxt_conf_vldt_user(nxt_conf_validation_t *vldt, char *name); 84static nxt_int_t nxt_conf_vldt_group(nxt_conf_validation_t *vldt, char *name); 85static nxt_int_t nxt_conf_vldt_environment(nxt_conf_validation_t *vldt, 86 nxt_str_t *name, nxt_conf_value_t *value); 87static nxt_int_t nxt_conf_vldt_argument(nxt_conf_validation_t *vldt, 88 nxt_conf_value_t *value); 89static nxt_int_t nxt_conf_vldt_php_option(nxt_conf_validation_t *vldt, 90 nxt_str_t *name, nxt_conf_value_t *value); | 1 2/* 3 * Copyright (C) Valentin V. Bartenev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7#include <nxt_main.h> 8#include <nxt_conf.h> --- 74 unchanged lines hidden (view full) --- 83static nxt_int_t nxt_conf_vldt_user(nxt_conf_validation_t *vldt, char *name); 84static nxt_int_t nxt_conf_vldt_group(nxt_conf_validation_t *vldt, char *name); 85static nxt_int_t nxt_conf_vldt_environment(nxt_conf_validation_t *vldt, 86 nxt_str_t *name, nxt_conf_value_t *value); 87static nxt_int_t nxt_conf_vldt_argument(nxt_conf_validation_t *vldt, 88 nxt_conf_value_t *value); 89static nxt_int_t nxt_conf_vldt_php_option(nxt_conf_validation_t *vldt, 90 nxt_str_t *name, nxt_conf_value_t *value); |
91static nxt_int_t nxt_conf_vldt_java_classpath(nxt_conf_validation_t *vldt, 92 nxt_conf_value_t *value); 93static nxt_int_t nxt_conf_vldt_java_option(nxt_conf_validation_t *vldt, 94 nxt_conf_value_t *value); |
|
91 92 93static nxt_conf_vldt_object_t nxt_conf_vldt_http_members[] = { 94 { nxt_string("header_read_timeout"), 95 NXT_CONF_VLDT_INTEGER, 96 NULL, 97 NULL }, 98 --- 319 unchanged lines hidden (view full) --- 418 NXT_CONF_VLDT_STRING, 419 NULL, 420 NULL }, 421 422 NXT_CONF_VLDT_NEXT(&nxt_conf_vldt_common_members) 423}; 424 425 | 95 96 97static nxt_conf_vldt_object_t nxt_conf_vldt_http_members[] = { 98 { nxt_string("header_read_timeout"), 99 NXT_CONF_VLDT_INTEGER, 100 NULL, 101 NULL }, 102 --- 319 unchanged lines hidden (view full) --- 422 NXT_CONF_VLDT_STRING, 423 NULL, 424 NULL }, 425 426 NXT_CONF_VLDT_NEXT(&nxt_conf_vldt_common_members) 427}; 428 429 |
430static nxt_conf_vldt_object_t nxt_conf_vldt_java_members[] = { 431 { nxt_string("classpath"), 432 NXT_CONF_VLDT_ARRAY, 433 &nxt_conf_vldt_array_iterator, 434 (void *) &nxt_conf_vldt_java_classpath}, 435 436 { nxt_string("webapp"), 437 NXT_CONF_VLDT_STRING, 438 NULL, 439 NULL }, 440 441 { nxt_string("options"), 442 NXT_CONF_VLDT_ARRAY, 443 &nxt_conf_vldt_array_iterator, 444 (void *) &nxt_conf_vldt_java_option}, 445 446 { nxt_string("unit_jars"), 447 NXT_CONF_VLDT_STRING, 448 NULL, 449 NULL }, 450 451 NXT_CONF_VLDT_NEXT(&nxt_conf_vldt_common_members) 452}; 453 454 |
|
426nxt_int_t 427nxt_conf_validate(nxt_conf_validation_t *vldt) 428{ 429 nxt_int_t ret; 430 431 ret = nxt_conf_vldt_type(vldt, NULL, vldt->conf, NXT_CONF_VLDT_OBJECT); 432 433 if (ret != NXT_OK) { --- 379 unchanged lines hidden (view full) --- 813 static nxt_str_t type_str = nxt_string("type"); 814 815 static void *members[] = { 816 nxt_conf_vldt_external_members, 817 nxt_conf_vldt_python_members, 818 nxt_conf_vldt_php_members, 819 nxt_conf_vldt_perl_members, 820 nxt_conf_vldt_ruby_members, | 455nxt_int_t 456nxt_conf_validate(nxt_conf_validation_t *vldt) 457{ 458 nxt_int_t ret; 459 460 ret = nxt_conf_vldt_type(vldt, NULL, vldt->conf, NXT_CONF_VLDT_OBJECT); 461 462 if (ret != NXT_OK) { --- 379 unchanged lines hidden (view full) --- 842 static nxt_str_t type_str = nxt_string("type"); 843 844 static void *members[] = { 845 nxt_conf_vldt_external_members, 846 nxt_conf_vldt_python_members, 847 nxt_conf_vldt_php_members, 848 nxt_conf_vldt_perl_members, 849 nxt_conf_vldt_ruby_members, |
850 nxt_conf_vldt_java_members, |
|
821 }; 822 823 ret = nxt_conf_vldt_type(vldt, name, value, NXT_CONF_VLDT_OBJECT); 824 825 if (ret != NXT_OK) { 826 return ret; 827 } 828 --- 382 unchanged lines hidden (view full) --- 1211 1212 if (nxt_conf_type(value) != NXT_CONF_STRING) { 1213 return nxt_conf_vldt_error(vldt, "The \"%V\" PHP option must be " 1214 "a string.", name); 1215 } 1216 1217 return NXT_OK; 1218} | 851 }; 852 853 ret = nxt_conf_vldt_type(vldt, name, value, NXT_CONF_VLDT_OBJECT); 854 855 if (ret != NXT_OK) { 856 return ret; 857 } 858 --- 382 unchanged lines hidden (view full) --- 1241 1242 if (nxt_conf_type(value) != NXT_CONF_STRING) { 1243 return nxt_conf_vldt_error(vldt, "The \"%V\" PHP option must be " 1244 "a string.", name); 1245 } 1246 1247 return NXT_OK; 1248} |
1249 1250 1251static nxt_int_t 1252nxt_conf_vldt_java_classpath(nxt_conf_validation_t *vldt, nxt_conf_value_t *value) 1253{ 1254 nxt_str_t str; 1255 1256 if (nxt_conf_type(value) != NXT_CONF_STRING) { 1257 return nxt_conf_vldt_error(vldt, "The \"classpath\" array " 1258 "must contain only string values."); 1259 } 1260 1261 nxt_conf_get_string(value, &str); 1262 1263 if (nxt_memchr(str.start, '\0', str.length) != NULL) { 1264 return nxt_conf_vldt_error(vldt, "The \"classpath\" array must not " 1265 "contain strings with null character."); 1266 } 1267 1268 return NXT_OK; 1269} 1270 1271static nxt_int_t 1272nxt_conf_vldt_java_option(nxt_conf_validation_t *vldt, nxt_conf_value_t *value) 1273{ 1274 nxt_str_t str; 1275 1276 if (nxt_conf_type(value) != NXT_CONF_STRING) { 1277 return nxt_conf_vldt_error(vldt, "The \"options\" array " 1278 "must contain only string values."); 1279 } 1280 1281 nxt_conf_get_string(value, &str); 1282 1283 if (nxt_memchr(str.start, '\0', str.length) != NULL) { 1284 return nxt_conf_vldt_error(vldt, "The \"options\" array must not " 1285 "contain strings with null character."); 1286 } 1287 1288 return NXT_OK; 1289} |
|