HTTP: controlling response headers support.
This commit is contained in:
@@ -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,
|
||||
@@ -688,6 +690,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
|
||||
};
|
||||
@@ -2447,6 +2455,35 @@ nxt_conf_vldt_object_conf_commands(nxt_conf_validation_t *vldt,
|
||||
#endif
|
||||
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user