ngx_int_t ngx_http_headers_more_exec_input_cmd(ngx_http_request_t *r, ngx_http_headers_more_cmd_t *cmd) { ngx_str_t value; ngx_http_headers_more_header_val_t *h; ngx_uint_t i; if (!cmd->headers) { return NGX_OK; } if (cmd->types && !ngx_http_headers_more_check_type(r, cmd->types)) { return NGX_OK; } h = cmd->headers->elts; for (i = 0; i < cmd->headers->nelts; i++) { if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) { return NGX_ERROR; } if (value.len) { value.len--; /* remove the trailing '\0' added by ngx_http_headers_more_parse_header */ } if (h[i].handler(r, &h[i], &value) != NGX_OK) { return NGX_ERROR; } } return NGX_OK; }
ngx_int_t ngx_http_headers_more_exec_cmd(ngx_http_request_t *r, ngx_http_headers_more_cmd_t *cmd) { ngx_str_t value; ngx_http_headers_more_header_val_t *h; ngx_uint_t i; if (!cmd->headers) { return NGX_OK; } if (cmd->types) { if ( ! ngx_http_headers_more_check_type(r, cmd->types) ) { return NGX_OK; } } if (cmd->statuses) { if ( ! ngx_http_headers_more_check_status(r, cmd->statuses) ) { return NGX_OK; } dd("status check is passed"); } h = cmd->headers->elts; for (i = 0; i < cmd->headers->nelts; i++) { if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) { return NGX_ERROR; } if (h[i].handler(r, &h[i], &value) != NGX_OK) { return NGX_ERROR; } } return NGX_OK; }