Commit 4e012c1
committed
fix response_type context and duplicate detection
The cache_purge_response_type directive had a flawed duplicate detection
guard that only checked for NGX_HTTP_LOC_CONF. This silently allowed
duplicate directives in http and server contexts to overwrite previous
values without throwing a configuration error. Additionally, a defunct
guard attempting to check for NGX_HTTP_MODULE was comparing context
flags against module-type magic bits, rendering it dead code.
Remove the invalid NGX_HTTP_MODULE check and make duplicate detection
unconditional. The directive is intentionally valid in http, server,
and location contexts, and merge_loc_conf propagates the value downward
appropriately. The README context documentation is updated to reflect
this correctly.
Furthermore, rename the internal configuration variable from resptype
to response_type for clarity. Fix a typo in the response type macro
definitions (NGX_REPONSE_TYPE_* to NGX_CACHE_PURGE_RESPONSE_TYPE_*)
and properly namespace them.
Clarify the documentation and internal comments for the
cache_purge_throttle_ms directive. Bare integers are evaluated as
milliseconds natively to match the directive's name, which differs
from the standard nginx time parser, logging a startup warning.
Add comprehensive test coverage in config.t to ensure proper context
inheritance, duplicate config rejection, and explicit time suffix parsing.1 parent 453776c commit 4e012c1
3 files changed
Lines changed: 92 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
204 | 205 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | 261 | | |
263 | 262 | | |
264 | 263 | | |
| |||
365 | 364 | | |
366 | 365 | | |
367 | 366 | | |
368 | | - | |
369 | | - | |
370 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
371 | 373 | | |
372 | 374 | | |
373 | 375 | | |
| |||
2322 | 2324 | | |
2323 | 2325 | | |
2324 | 2326 | | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
| 2327 | + | |
2328 | 2328 | | |
2329 | 2329 | | |
2330 | 2330 | | |
2331 | 2331 | | |
2332 | 2332 | | |
2333 | 2333 | | |
2334 | 2334 | | |
2335 | | - | |
2336 | | - | |
2337 | | - | |
2338 | | - | |
2339 | 2335 | | |
2340 | 2336 | | |
2341 | 2337 | | |
2342 | | - | |
| 2338 | + | |
2343 | 2339 | | |
2344 | | - | |
| 2340 | + | |
2345 | 2341 | | |
2346 | | - | |
| 2342 | + | |
2347 | 2343 | | |
2348 | | - | |
| 2344 | + | |
2349 | 2345 | | |
2350 | 2346 | | |
2351 | 2347 | | |
| |||
2495 | 2491 | | |
2496 | 2492 | | |
2497 | 2493 | | |
2498 | | - | |
2499 | | - | |
| 2494 | + | |
| 2495 | + | |
2500 | 2496 | | |
2501 | 2497 | | |
2502 | 2498 | | |
2503 | 2499 | | |
2504 | 2500 | | |
2505 | | - | |
| 2501 | + | |
2506 | 2502 | | |
2507 | 2503 | | |
2508 | 2504 | | |
2509 | 2505 | | |
2510 | 2506 | | |
2511 | | - | |
| 2507 | + | |
2512 | 2508 | | |
2513 | 2509 | | |
2514 | 2510 | | |
2515 | 2511 | | |
2516 | 2512 | | |
2517 | 2513 | | |
2518 | | - | |
| 2514 | + | |
2519 | 2515 | | |
2520 | 2516 | | |
2521 | 2517 | | |
| |||
3023 | 3019 | | |
3024 | 3020 | | |
3025 | 3021 | | |
3026 | | - | |
| 3022 | + | |
3027 | 3023 | | |
3028 | 3024 | | |
3029 | 3025 | | |
| |||
3038 | 3034 | | |
3039 | 3035 | | |
3040 | 3036 | | |
3041 | | - | |
3042 | | - | |
| 3037 | + | |
| 3038 | + | |
3043 | 3039 | | |
3044 | 3040 | | |
3045 | 3041 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
0 commit comments