﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
2215	Maybe a minior bug in $request_completion code	chronolaw@…		"Hi,

When I do some test on NGINX variables, I found some strange behavior about $request_completion.

Give the config:

log_format resp_demo '$request_completion';
  location /resp {
    access_log  /var/log/nginx/access.log  resp_demo;
    return 200 '$request_completion\n';
  }

Then I run curl 127.1/resp, we get ''(empty string).
Because $request_completion is defined as CACHEABLE, so when we log it in access.log ,it will be the same empty value, not the right value 'OK'.

I think $request_completion should act as other variables like $is_arg, Shall we change the flag to NGX_HTTP_VAR_NOCACHEABLE?

Here is my patch:

--- ngx_http_variables.c.old	2021-07-12 20:11:59.985843678 +0800
+++ ngx_http_variables.c	2021-07-12 20:12:22.881285689 +0800
@@ -282,7 +282,7 @@
 
     { ngx_string(""request_completion""), NULL,
       ngx_http_variable_request_completion,
-      0, 0, 0 },
+      0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
 
     { ngx_string(""request_body""), NULL,
       ngx_http_variable_request_body,"	defect	closed	minor	nginx-1.21	documentation	1.19.x	wontfix	variable		Linux	nginx 1.19.10
