@@ -716,6 +716,10 @@ ngx_http_cache_purge_access_handler(ngx_http_request_t *r)
716
716
return NGX_HTTP_FORBIDDEN ;
717
717
}
718
718
719
+ if (cplcf -> handler == NULL ) {
720
+ return NGX_HTTP_NOT_FOUND ;
721
+ }
722
+
719
723
return cplcf -> handler (r );
720
724
}
721
725
@@ -1184,11 +1188,10 @@ ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1184
1188
if (conf -> fastcgi .enable && clcf -> handler != NULL ) {
1185
1189
flcf = ngx_http_conf_get_module_loc_conf (cf , ngx_http_fastcgi_module );
1186
1190
1187
- if (flcf -> upstream .cache
1188
- && (flcf -> upstream .upstream || flcf -> fastcgi_lengths ))
1189
- {
1191
+ if (flcf -> upstream .upstream || flcf -> fastcgi_lengths ) {
1190
1192
conf -> conf = & conf -> fastcgi ;
1191
- conf -> handler = ngx_http_fastcgi_cache_purge_handler ;
1193
+ conf -> handler = flcf -> upstream .cache
1194
+ ? ngx_http_fastcgi_cache_purge_handler : NULL ;
1192
1195
conf -> original_handler = clcf -> handler ;
1193
1196
1194
1197
clcf -> handler = ngx_http_cache_purge_access_handler ;
@@ -1204,11 +1207,10 @@ ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1204
1207
if (conf -> proxy .enable && clcf -> handler != NULL ) {
1205
1208
plcf = ngx_http_conf_get_module_loc_conf (cf , ngx_http_proxy_module );
1206
1209
1207
- if (plcf -> upstream .cache
1208
- && (plcf -> upstream .upstream || plcf -> proxy_lengths ))
1209
- {
1210
+ if (plcf -> upstream .upstream || plcf -> proxy_lengths ) {
1210
1211
conf -> conf = & conf -> proxy ;
1211
- conf -> handler = ngx_http_proxy_cache_purge_handler ;
1212
+ conf -> handler = plcf -> upstream .cache
1213
+ ? ngx_http_proxy_cache_purge_handler : NULL ;
1212
1214
conf -> original_handler = clcf -> handler ;
1213
1215
1214
1216
clcf -> handler = ngx_http_cache_purge_access_handler ;
@@ -1224,13 +1226,11 @@ ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1224
1226
if (conf -> scgi .enable && clcf -> handler != NULL ) {
1225
1227
slcf = ngx_http_conf_get_module_loc_conf (cf , ngx_http_scgi_module );
1226
1228
1227
- if (slcf -> upstream .cache
1228
- && (slcf -> upstream .upstream || slcf -> scgi_lengths ))
1229
- {
1229
+ if (slcf -> upstream .upstream || slcf -> scgi_lengths ) {
1230
1230
conf -> conf = & conf -> scgi ;
1231
- conf -> handler = ngx_http_scgi_cache_purge_handler ;
1231
+ conf -> handler = slcf -> upstream .cache
1232
+ ? ngx_http_scgi_cache_purge_handler : NULL ;
1232
1233
conf -> original_handler = clcf -> handler ;
1233
-
1234
1234
clcf -> handler = ngx_http_cache_purge_access_handler ;
1235
1235
1236
1236
return NGX_CONF_OK ;
@@ -1244,11 +1244,10 @@ ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1244
1244
if (conf -> uwsgi .enable && clcf -> handler != NULL ) {
1245
1245
ulcf = ngx_http_conf_get_module_loc_conf (cf , ngx_http_uwsgi_module );
1246
1246
1247
- if (ulcf -> upstream .cache
1248
- && (ulcf -> upstream .upstream || ulcf -> uwsgi_lengths ))
1249
- {
1247
+ if (ulcf -> upstream .upstream || ulcf -> uwsgi_lengths ) {
1250
1248
conf -> conf = & conf -> uwsgi ;
1251
- conf -> handler = ngx_http_uwsgi_cache_purge_handler ;
1249
+ conf -> handler = ulcf -> upstream .cache
1250
+ ? ngx_http_uwsgi_cache_purge_handler : NULL ;
1252
1251
conf -> original_handler = clcf -> handler ;
1253
1252
1254
1253
clcf -> handler = ngx_http_cache_purge_access_handler ;
0 commit comments