Welcome! Log In Create A New Profile

Advanced

[PATCH] Allow 1xx 2xx 3xx 4xx 5xx codes in xxxxx_cache_valid directives.

Gena Makhomed
September 21, 2018 07:26AM
# HG changeset patch
# User Gena Makhomed <gmm@csdoc.com>
# Date 1537528104 -10800
# Fri Sep 21 14:08:24 2018 +0300
# Node ID a7533f3f3138fe5524a0f14293da4149e65b1402
# Parent 87d2ea860f380dc8418c97c0163412f53c2d008e
Allow 1xx 2xx 3xx 4xx 5xx codes in xxxxx_cache_valid directives.

For example, config fragment

fastcgi_cache_valid 200 201 202 203 204 205 206 207 208 226 5m;
fastcgi_cache_valid 300 301 302 303 304 305 306 307 308 10m;

now can be rewritten as

fastcgi_cache_valid 2xx 5m;
fastcgi_cache_valid 3xx 10m;

diff -r 87d2ea860f38 -r a7533f3f3138 src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c Mon Sep 10 18:57:39 2018 +0300
+++ b/src/http/ngx_http_file_cache.c Fri Sep 21 14:08:24 2018 +0300
@@ -2290,6 +2290,26 @@
return valid[i].valid;
}

+ if (valid[i].status == 1 && status >= 100 && status <= 199) {
+ return valid[i].valid;
+ }
+
+ if (valid[i].status == 2 && status >= 200 && status <= 299) {
+ return valid[i].valid;
+ }
+
+ if (valid[i].status == 3 && status >= 300 && status <= 399) {
+ return valid[i].valid;
+ }
+
+ if (valid[i].status == 4 && status >= 400 && status <= 499) {
+ return valid[i].valid;
+ }
+
+ if (valid[i].status == 5 && status >= 500 && status <= 599) {
+ return valid[i].valid;
+ }
+
if (valid[i].status == status) {
return valid[i].valid;
}
@@ -2666,10 +2686,30 @@

status = 0;

+ } else if(ngx_strcmp(value[i].data, "1xx") == 0) {
+
+ status = 1;
+
+ } else if(ngx_strcmp(value[i].data, "2xx") == 0) {
+
+ status = 2;
+
+ } else if(ngx_strcmp(value[i].data, "3xx") == 0) {
+
+ status = 3;
+
+ } else if(ngx_strcmp(value[i].data, "4xx") == 0) {
+
+ status = 4;
+
+ } else if(ngx_strcmp(value[i].data, "5xx") == 0) {
+
+ status = 5;
+
} 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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Allow 1xx 2xx 3xx 4xx 5xx codes in xxxxx_cache_valid directives.

Gena Makhomed 387 September 21, 2018 07:26AM

Re: [PATCH] Allow 1xx 2xx 3xx 4xx 5xx codes in xxxxx_cache_valid directives.

Maxim Dounin 182 September 21, 2018 09:00AM

[PATCH] Add 307 and 308 to default response codes for xxxxx_cache_valid.

Gena Makhomed 196 September 21, 2018 11:36AM

Re: [PATCH] Add 307 and 308 to default response codes for xxxxx_cache_valid.

Maxim Dounin 171 September 24, 2018 12:26PM

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

Gena Makhomed 170 September 24, 2018 01:36PM

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

Maxim Dounin 183 September 24, 2018 02:02PM

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

Gena Makhomed 152 September 24, 2018 03:12PM

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

Maxim Dounin 212 September 24, 2018 07:34PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 286
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready