summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf_validation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r--src/nxt_conf_validation.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c
index 8c75a9fe..f00b28b8 100644
--- a/src/nxt_conf_validation.c
+++ b/src/nxt_conf_validation.c
@@ -167,6 +167,8 @@ static nxt_int_t nxt_conf_vldt_match_addrs(nxt_conf_validation_t *vldt,
nxt_conf_value_t *value, void *data);
static nxt_int_t nxt_conf_vldt_match_addr(nxt_conf_validation_t *vldt,
nxt_conf_value_t *value);
+static nxt_int_t nxt_conf_vldt_response_header(nxt_conf_validation_t *vldt,
+ nxt_str_t *name, nxt_conf_value_t *value);
static nxt_int_t nxt_conf_vldt_app_name(nxt_conf_validation_t *vldt,
nxt_conf_value_t *value, void *data);
static nxt_int_t nxt_conf_vldt_forwarded(nxt_conf_validation_t *vldt,
@@ -250,6 +252,7 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_python_target_members[];
static nxt_conf_vldt_object_t nxt_conf_vldt_php_common_members[];
static nxt_conf_vldt_object_t nxt_conf_vldt_php_options_members[];
static nxt_conf_vldt_object_t nxt_conf_vldt_php_target_members[];
+static nxt_conf_vldt_object_t nxt_conf_vldt_wasm_access_members[];
static nxt_conf_vldt_object_t nxt_conf_vldt_common_members[];
static nxt_conf_vldt_object_t nxt_conf_vldt_app_limits_members[];
static nxt_conf_vldt_object_t nxt_conf_vldt_app_processes_members[];
@@ -688,6 +691,12 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_action_common_members[] = {
.name = nxt_string("rewrite"),
.type = NXT_CONF_VLDT_STRING,
},
+ {
+ .name = nxt_string("response_headers"),
+ .type = NXT_CONF_VLDT_OBJECT,
+ .validator = nxt_conf_vldt_object_iterator,
+ .u.object = nxt_conf_vldt_response_header,
+ },
NXT_CONF_VLDT_END
};
@@ -1041,6 +1050,59 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_java_members[] = {
};
+static nxt_conf_vldt_object_t nxt_conf_vldt_wasm_members[] = {
+ {
+ .name = nxt_string("module"),
+ .type = NXT_CONF_VLDT_STRING,
+ .flags = NXT_CONF_VLDT_REQUIRED,
+ }, {
+ .name = nxt_string("request_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ .flags = NXT_CONF_VLDT_REQUIRED,
+ },{
+ .name = nxt_string("malloc_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ .flags = NXT_CONF_VLDT_REQUIRED,
+ }, {
+ .name = nxt_string("free_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ .flags = NXT_CONF_VLDT_REQUIRED,
+ }, {
+ .name = nxt_string("module_init_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ }, {
+ .name = nxt_string("module_end_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ }, {
+ .name = nxt_string("request_init_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ }, {
+ .name = nxt_string("request_end_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ }, {
+ .name = nxt_string("response_end_handler"),
+ .type = NXT_CONF_VLDT_STRING,
+ }, {
+ .name = nxt_string("access"),
+ .type = NXT_CONF_VLDT_OBJECT,
+ .validator = nxt_conf_vldt_object,
+ .u.members = nxt_conf_vldt_wasm_access_members,
+ },
+
+ NXT_CONF_VLDT_NEXT(nxt_conf_vldt_common_members)
+};
+
+
+static nxt_conf_vldt_object_t nxt_conf_vldt_wasm_access_members[] = {
+ {
+ .name = nxt_string("filesystem"),
+ .type = NXT_CONF_VLDT_ARRAY,
+ },
+
+ NXT_CONF_VLDT_END
+};
+
+
static nxt_conf_vldt_object_t nxt_conf_vldt_common_members[] = {
{
.name = nxt_string("type"),
@@ -2448,6 +2510,35 @@ nxt_conf_vldt_object_conf_commands(nxt_conf_validation_t *vldt,
static nxt_int_t
+nxt_conf_vldt_response_header(nxt_conf_validation_t *vldt, nxt_str_t *name,
+ nxt_conf_value_t *value)
+{
+ nxt_uint_t type;
+
+ static nxt_str_t content_length = nxt_string("Content-Length");
+
+ if (name->length == 0) {
+ return nxt_conf_vldt_error(vldt, "The response header name "
+ "must not be empty.");
+ }
+
+ if (nxt_strstr_eq(name, &content_length)) {
+ return nxt_conf_vldt_error(vldt, "The \"Content-Length\" response "
+ "header value is not supported");
+ }
+
+ type = nxt_conf_type(value);
+
+ if (type == NXT_CONF_STRING || type == NXT_CONF_NULL) {
+ return NXT_OK;
+ }
+
+ return nxt_conf_vldt_error(vldt, "The \"%V\" response header value "
+ "must either be a string or a null", name);
+}
+
+
+static nxt_int_t
nxt_conf_vldt_app_name(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
void *data)
{
@@ -2525,6 +2616,7 @@ nxt_conf_vldt_app(nxt_conf_validation_t *vldt, nxt_str_t *name,
{ nxt_conf_vldt_object, nxt_conf_vldt_perl_members },
{ nxt_conf_vldt_object, nxt_conf_vldt_ruby_members },
{ nxt_conf_vldt_object, nxt_conf_vldt_java_members },
+ { nxt_conf_vldt_object, nxt_conf_vldt_wasm_members },
};
ret = nxt_conf_vldt_type(vldt, name, value, NXT_CONF_VLDT_OBJECT);