[PATCH] Cache: status must be less then 599 in *_cache_valid directives.

Gena Makhomed gmm at csdoc.com
Mon Sep 24 19:10:08 UTC 2018


On 24.09.2018 21:00, Maxim Dounin wrote:

>> # HG changeset patch
>> # User Gena Makhomed <gmm at csdoc.com>
>> # Date 1537810006 -10800
>> #      Mon Sep 24 20:26:46 2018 +0300
>> # Node ID fc6c7e03edaad907d6a85afab009cb5c1fa43c56
>> # Parent  17092295247709a533acca09f990c13337a24948
>> Cache: status must be less then 599 in *_cache_valid directives.
>>
>> Previously, configurations with typo, for example
>>
>>       fastcgi_cache_valid 200301 302 5m;
>>
>> successfully pass configuration test. Adding check for status
>> codes > 599, and such configurations are now properly rejected.

> Have you seen such configurations in the real life, or it is
> something made-up while looking at the code?

While looking at the code and your patch
http://hg.nginx.org/nginx/rev/7c614ef3c6ea

Did you see in the real life configurations
need for *_cache_valid status codes > 599 ?

>> diff -r 170922952477 -r fc6c7e03edaa src/http/ngx_http_file_cache.c
>> --- a/src/http/ngx_http_file_cache.c	Wed Sep 19 09:26:47 2018 -0500
>> +++ b/src/http/ngx_http_file_cache.c	Mon Sep 24 20:26:46 2018 +0300
>> @@ -2669,7 +2669,7 @@
>>            } else {
>>
>>                status = ngx_atoi(value[i].data, value[i].len);
>> -            if (status < 100) {
>> +            if (status < 100 || status > 599) {
>>                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
>>                                       "invalid status \"%V\"", &value[i]);
>>                    return NGX_CONF_ERROR;

-- 
Best regards,
  Gena


More information about the nginx-devel mailing list