fix English grammar
Igor Sysoev
14 years ago
27 | 27 | unsigned len:29; |
28 | 28 | |
29 | 29 | unsigned valid:1; |
30 | unsigned no_cachable:1; | |
30 | unsigned no_cacheable:1; | |
31 | 31 | unsigned not_found:1; |
32 | 32 | |
33 | 33 | u_char *data; |
8 | 8 | #include <ngx_event.h> |
9 | 9 | |
10 | 10 | |
11 | static ngx_int_t ngx_event_busy_lock_look_cachable(ngx_event_busy_lock_t *bl, | |
11 | static ngx_int_t ngx_event_busy_lock_look_cacheable(ngx_event_busy_lock_t *bl, | |
12 | 12 | ngx_event_busy_lock_ctx_t *ctx); |
13 | 13 | static void ngx_event_busy_lock_handler(ngx_event_t *ev); |
14 | 14 | static void ngx_event_busy_lock_posted_handler(ngx_event_t *ev); |
64 | 64 | |
65 | 65 | |
66 | 66 | ngx_int_t |
67 | ngx_event_busy_lock_cachable(ngx_event_busy_lock_t *bl, | |
67 | ngx_event_busy_lock_cacheable(ngx_event_busy_lock_t *bl, | |
68 | 68 | ngx_event_busy_lock_ctx_t *ctx) |
69 | 69 | { |
70 | 70 | ngx_int_t rc; |
71 | 71 | |
72 | 72 | ngx_mutex_lock(bl->mutex); |
73 | 73 | |
74 | rc = ngx_event_busy_lock_look_cachable(bl, ctx); | |
74 | rc = ngx_event_busy_lock_look_cacheable(bl, ctx); | |
75 | 75 | |
76 | 76 | ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ctx->event->log, 0, |
77 | 77 | "event busy lock: %d w:%d mw:%d", |
200 | 200 | |
201 | 201 | |
202 | 202 | static ngx_int_t |
203 | ngx_event_busy_lock_look_cachable(ngx_event_busy_lock_t *bl, | |
203 | ngx_event_busy_lock_look_cacheable(ngx_event_busy_lock_t *bl, | |
204 | 204 | ngx_event_busy_lock_ctx_t *ctx) |
205 | 205 | { |
206 | 206 | ngx_int_t free; |
207 | ngx_uint_t i, bit, cachable, mask; | |
207 | ngx_uint_t i, bit, cacheable, mask; | |
208 | 208 | |
209 | 209 | bit = 0; |
210 | cachable = 0; | |
210 | cacheable = 0; | |
211 | 211 | free = -1; |
212 | 212 | |
213 | 213 | #if (NGX_SUPPRESS_WARN) |
226 | 226 | ctx->slot = i; |
227 | 227 | return NGX_AGAIN; |
228 | 228 | } |
229 | cachable++; | |
229 | cacheable++; | |
230 | 230 | |
231 | 231 | } else if (free == -1) { |
232 | 232 | free = i; |
233 | 233 | } |
234 | 234 | |
235 | if (cachable == bl->cachable) { | |
236 | if (free == -1 && cachable < bl->max_busy) { | |
235 | if (cacheable == bl->cacheable) { | |
236 | if (free == -1 && cacheable < bl->max_busy) { | |
237 | 237 | free = i + 1; |
238 | 238 | } |
239 | 239 | |
258 | 258 | bl->md5_mask[free / 8] |= 1 << (free & 7); |
259 | 259 | ctx->slot = free; |
260 | 260 | |
261 | bl->cachable++; | |
261 | bl->cacheable++; | |
262 | 262 | bl->busy++; |
263 | 263 | |
264 | 264 | return NGX_OK; |
33 | 33 | typedef struct { |
34 | 34 | u_char *md5_mask; |
35 | 35 | char *md5; |
36 | ngx_uint_t cachable; | |
36 | ngx_uint_t cacheable; | |
37 | 37 | |
38 | 38 | ngx_uint_t busy; |
39 | 39 | ngx_uint_t max_busy; |
52 | 52 | |
53 | 53 | ngx_int_t ngx_event_busy_lock(ngx_event_busy_lock_t *bl, |
54 | 54 | ngx_event_busy_lock_ctx_t *ctx); |
55 | ngx_int_t ngx_event_busy_lock_cachable(ngx_event_busy_lock_t *bl, | |
55 | ngx_int_t ngx_event_busy_lock_cacheable(ngx_event_busy_lock_t *bl, | |
56 | 56 | ngx_event_busy_lock_ctx_t *ctx); |
57 | 57 | void ngx_event_busy_unlock(ngx_event_busy_lock_t *bl, |
58 | 58 | ngx_event_busy_lock_ctx_t *ctx); |
191 | 191 | chain->buf = b; |
192 | 192 | chain->next = NULL; |
193 | 193 | |
194 | } else if (!p->cachable | |
194 | } else if (!p->cacheable | |
195 | 195 | && p->downstream->data == p->output_ctx |
196 | 196 | && p->downstream->write->ready |
197 | 197 | && !p->downstream->write->delayed) |
208 | 208 | |
209 | 209 | break; |
210 | 210 | |
211 | } else if (p->cachable | |
211 | } else if (p->cacheable | |
212 | 212 | || p->temp_file->offset < p->max_temp_file_size) |
213 | 213 | { |
214 | 214 | |
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | if (p->cachable && p->in) { | |
408 | if (p->cacheable && p->in) { | |
409 | 409 | if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) { |
410 | 410 | return NGX_ABORT; |
411 | 411 | } |
541 | 541 | |
542 | 542 | ngx_event_pipe_free_shadow_raw_buf(&p->free_raw_bufs, cl->buf); |
543 | 543 | |
544 | } else if (!p->cachable && p->in) { | |
544 | } else if (!p->cacheable && p->in) { | |
545 | 545 | cl = p->in; |
546 | 546 | |
547 | 547 | ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, |
611 | 611 | for (cl = p->free; cl; cl = cl->next) { |
612 | 612 | |
613 | 613 | if (cl->buf->temp_file) { |
614 | if (p->cachable || !p->cyclic_temp_file) { | |
614 | if (p->cacheable || !p->cyclic_temp_file) { | |
615 | 615 | continue; |
616 | 616 | } |
617 | 617 | |
658 | 658 | out = p->in; |
659 | 659 | } |
660 | 660 | |
661 | if (!p->cachable) { | |
661 | if (!p->cacheable) { | |
662 | 662 | |
663 | 663 | size = 0; |
664 | 664 | cl = out; |
46 | 46 | void *output_ctx; |
47 | 47 | |
48 | 48 | unsigned read:1; |
49 | unsigned cachable:1; | |
49 | unsigned cacheable:1; | |
50 | 50 | unsigned single_buf:1; |
51 | 51 | unsigned free_bufs:1; |
52 | 52 | unsigned upstream_done:1; |
396 | 396 | |
397 | 397 | for (var = ngx_http_browsers; var->name.len; var++) { |
398 | 398 | |
399 | v = ngx_http_add_variable(cf, &var->name, NGX_HTTP_VAR_CHANGABLE); | |
399 | v = ngx_http_add_variable(cf, &var->name, NGX_HTTP_VAR_CHANGEABLE); | |
400 | 400 | if (v == NULL) { |
401 | 401 | return NGX_ERROR; |
402 | 402 | } |
672 | 672 | |
673 | 673 | bcf->modern_browser_value->len = value[1].len; |
674 | 674 | bcf->modern_browser_value->valid = 1; |
675 | bcf->modern_browser_value->no_cachable = 0; | |
675 | bcf->modern_browser_value->no_cacheable = 0; | |
676 | 676 | bcf->modern_browser_value->not_found = 0; |
677 | 677 | bcf->modern_browser_value->data = value[1].data; |
678 | 678 | |
697 | 697 | |
698 | 698 | bcf->ancient_browser_value->len = value[1].len; |
699 | 699 | bcf->ancient_browser_value->valid = 1; |
700 | bcf->ancient_browser_value->no_cachable = 0; | |
700 | bcf->ancient_browser_value->no_cacheable = 0; | |
701 | 701 | bcf->ancient_browser_value->not_found = 0; |
702 | 702 | bcf->ancient_browser_value->data = value[1].data; |
703 | 703 |
504 | 504 | if (flcf->params_len) { |
505 | 505 | ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); |
506 | 506 | |
507 | ngx_http_script_flush_no_cachable_variables(r, flcf->flushes); | |
507 | ngx_http_script_flush_no_cacheable_variables(r, flcf->flushes); | |
508 | 508 | le.flushed = 1; |
509 | 509 | |
510 | 510 | le.ip = flcf->params_len->elts; |
1185 | 1185 | |
1186 | 1186 | u->state->status = u->headers_in.status_n; |
1187 | 1187 | #if 0 |
1188 | if (u->cachable) { | |
1189 | u->cachable = ngx_http_upstream_is_cachable(r); | |
1188 | if (u->cacheable) { | |
1189 | u->cacheable = ngx_http_upstream_is_cacheable(r); | |
1190 | 1190 | } |
1191 | 1191 | #endif |
1192 | 1192 | |
1609 | 1609 | ngx_http_variable_t *var; |
1610 | 1610 | |
1611 | 1611 | var = ngx_http_add_variable(cf, &ngx_http_fastcgi_script_name, |
1612 | NGX_HTTP_VAR_NOHASH|NGX_HTTP_VAR_NOCACHABLE); | |
1612 | NGX_HTTP_VAR_NOHASH|NGX_HTTP_VAR_NOCACHEABLE); | |
1613 | 1613 | if (var == NULL) { |
1614 | 1614 | return NGX_ERROR; |
1615 | 1615 | } |
2103 | 2103 | |
2104 | 2104 | if (r->uri.len) { |
2105 | 2105 | v->valid = 1; |
2106 | v->no_cachable = 0; | |
2106 | v->no_cacheable = 0; | |
2107 | 2107 | v->not_found = 0; |
2108 | 2108 | |
2109 | 2109 | flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); |
2127 | 2127 | } else { |
2128 | 2128 | v->len = 0; |
2129 | 2129 | v->valid = 1; |
2130 | v->no_cachable = 0; | |
2130 | v->no_cacheable = 0; | |
2131 | 2131 | v->not_found = 0; |
2132 | 2132 | v->data = NULL; |
2133 | 2133 |
115 | 115 | name.data++; |
116 | 116 | } |
117 | 117 | |
118 | var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGABLE); | |
118 | var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); | |
119 | 119 | if (var == NULL) { |
120 | 120 | return NGX_CONF_ERROR; |
121 | 121 | } |
256 | 256 | } |
257 | 257 | |
258 | 258 | var->valid = 1; |
259 | var->no_cachable = 0; | |
259 | var->no_cacheable = 0; | |
260 | 260 | var->not_found = 0; |
261 | 261 | |
262 | 262 | v = ngx_array_push(&ctx->values); |
939 | 939 | ngx_http_gzip_ctx_t *ctx; |
940 | 940 | |
941 | 941 | v->valid = 1; |
942 | v->no_cachable = 0; | |
942 | v->no_cacheable = 0; | |
943 | 943 | v->not_found = 0; |
944 | 944 | |
945 | 945 | ctx = ngx_http_get_module_ctx(r, ngx_http_gzip_filter_module); |
220 | 220 | name.len--; |
221 | 221 | name.data++; |
222 | 222 | |
223 | var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGABLE); | |
223 | var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); | |
224 | 224 | if (var == NULL) { |
225 | 225 | return NGX_CONF_ERROR; |
226 | 226 | } |
429 | 429 | } |
430 | 430 | |
431 | 431 | var->valid = 1; |
432 | var->no_cachable = 0; | |
432 | var->no_cacheable = 0; | |
433 | 433 | var->not_found = 0; |
434 | 434 | |
435 | 435 | vp = ngx_array_push(&ctx->values_hash[key]); |
419 | 419 | static ngx_http_variable_t ngx_http_proxy_vars[] = { |
420 | 420 | |
421 | 421 | { ngx_string("proxy_host"), NULL, ngx_http_proxy_host_variable, 0, |
422 | NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOHASH, 0 }, | |
422 | NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOHASH, 0 }, | |
423 | 423 | |
424 | 424 | { ngx_string("proxy_port"), NULL, ngx_http_proxy_port_variable, 0, |
425 | NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOHASH, 0 }, | |
425 | NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOHASH, 0 }, | |
426 | 426 | |
427 | 427 | { ngx_string("proxy_add_x_forwarded_for"), NULL, |
428 | 428 | ngx_http_proxy_add_x_forwarded_for_variable, 0, NGX_HTTP_VAR_NOHASH, 0 }, |
560 | 560 | len += r->uri.len - loc_len + escape + sizeof("?") - 1 + r->args.len; |
561 | 561 | } |
562 | 562 | |
563 | ngx_http_script_flush_no_cachable_variables(r, plcf->flushes); | |
563 | ngx_http_script_flush_no_cacheable_variables(r, plcf->flushes); | |
564 | 564 | |
565 | 565 | if (plcf->body_set_len) { |
566 | 566 | le.ip = plcf->body_set_len->elts; |
1248 | 1248 | |
1249 | 1249 | v->len = plcf->host_header.len; |
1250 | 1250 | v->valid = 1; |
1251 | v->no_cachable = 0; | |
1251 | v->no_cacheable = 0; | |
1252 | 1252 | v->not_found = 0; |
1253 | 1253 | v->data = plcf->host_header.data; |
1254 | 1254 | |
1266 | 1266 | |
1267 | 1267 | v->len = plcf->port.len; |
1268 | 1268 | v->valid = 1; |
1269 | v->no_cachable = 0; | |
1269 | v->no_cacheable = 0; | |
1270 | 1270 | v->not_found = 0; |
1271 | 1271 | v->data = plcf->port.data; |
1272 | 1272 | |
1281 | 1281 | u_char *p; |
1282 | 1282 | |
1283 | 1283 | v->valid = 1; |
1284 | v->no_cachable = 0; | |
1284 | v->no_cacheable = 0; | |
1285 | 1285 | v->not_found = 0; |
1286 | 1286 | |
1287 | 1287 | if (r->headers_in.x_forwarded_for == NULL) { |
1325 | 1325 | } |
1326 | 1326 | |
1327 | 1327 | v->valid = 1; |
1328 | v->no_cachable = 0; | |
1328 | v->no_cacheable = 0; | |
1329 | 1329 | v->not_found = 0; |
1330 | 1330 | |
1331 | 1331 | v->data = ngx_palloc(r->connection->pool, NGX_SIZE_T_LEN); |
366 | 366 | name.data = (u_char *) "invalid_referer"; |
367 | 367 | |
368 | 368 | var = ngx_http_add_variable(cf, &name, |
369 | NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOHASH); | |
369 | NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOHASH); | |
370 | 370 | if (var == NULL) { |
371 | 371 | return NGX_CONF_ERROR; |
372 | 372 | } |
923 | 923 | value[1].len--; |
924 | 924 | value[1].data++; |
925 | 925 | |
926 | v = ngx_http_add_variable(cf, &value[1], NGX_HTTP_VAR_CHANGABLE); | |
926 | v = ngx_http_add_variable(cf, &value[1], NGX_HTTP_VAR_CHANGEABLE); | |
927 | 927 | if (v == NULL) { |
928 | 928 | return NGX_CONF_ERROR; |
929 | 929 | } |
302 | 302 | static ngx_http_variable_t ngx_http_ssi_vars[] = { |
303 | 303 | |
304 | 304 | { ngx_string("date_local"), NULL, ngx_http_ssi_date_gmt_local_variable, 0, |
305 | NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
305 | NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
306 | 306 | |
307 | 307 | { ngx_string("date_gmt"), NULL, ngx_http_ssi_date_gmt_local_variable, 1, |
308 | NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
308 | NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
309 | 309 | |
310 | 310 | { ngx_null_string, NULL, NULL, 0, 0, 0 } |
311 | 311 | }; |
2640 | 2640 | char buf[NGX_HTTP_SSI_DATE_LEN]; |
2641 | 2641 | |
2642 | 2642 | v->valid = 1; |
2643 | v->no_cachable = 0; | |
2643 | v->no_cacheable = 0; | |
2644 | 2644 | v->not_found = 0; |
2645 | 2645 | |
2646 | 2646 | tp = ngx_timeofday(); |
169 | 169 | static ngx_http_variable_t ngx_http_ssl_vars[] = { |
170 | 170 | |
171 | 171 | { ngx_string("ssl_protocol"), NULL, ngx_http_ssl_static_variable, |
172 | (uintptr_t) ngx_ssl_get_protocol, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
172 | (uintptr_t) ngx_ssl_get_protocol, NGX_HTTP_VAR_CHANGEABLE, 0 }, | |
173 | 173 | |
174 | 174 | { ngx_string("ssl_cipher"), NULL, ngx_http_ssl_static_variable, |
175 | (uintptr_t) ngx_ssl_get_cipher_name, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
175 | (uintptr_t) ngx_ssl_get_cipher_name, NGX_HTTP_VAR_CHANGEABLE, 0 }, | |
176 | 176 | |
177 | 177 | { ngx_string("ssl_client_s_dn"), NULL, ngx_http_ssl_variable, |
178 | (uintptr_t) ngx_ssl_get_subject_dn, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
178 | (uintptr_t) ngx_ssl_get_subject_dn, NGX_HTTP_VAR_CHANGEABLE, 0 }, | |
179 | 179 | |
180 | 180 | { ngx_string("ssl_client_i_dn"), NULL, ngx_http_ssl_variable, |
181 | (uintptr_t) ngx_ssl_get_issuer_dn, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
181 | (uintptr_t) ngx_ssl_get_issuer_dn, NGX_HTTP_VAR_CHANGEABLE, 0 }, | |
182 | 182 | |
183 | 183 | { ngx_string("ssl_client_serial"), NULL, ngx_http_ssl_variable, |
184 | (uintptr_t) ngx_ssl_get_serial_number, NGX_HTTP_VAR_CHANGABLE, 0 }, | |
184 | (uintptr_t) ngx_ssl_get_serial_number, NGX_HTTP_VAR_CHANGEABLE, 0 }, | |
185 | 185 | |
186 | 186 | { ngx_null_string, NULL, NULL, 0, 0, 0 } |
187 | 187 | }; |
209 | 209 | |
210 | 210 | v->len = len; |
211 | 211 | v->valid = 1; |
212 | v->no_cachable = 0; | |
212 | v->no_cacheable = 0; | |
213 | 213 | v->not_found = 0; |
214 | 214 | |
215 | 215 | return NGX_OK; |
240 | 240 | |
241 | 241 | if (v->len) { |
242 | 242 | v->valid = 1; |
243 | v->no_cachable = 0; | |
243 | v->no_cacheable = 0; | |
244 | 244 | v->not_found = 0; |
245 | 245 | |
246 | 246 | return NGX_OK; |
492 | 492 | } |
493 | 493 | |
494 | 494 | v->valid = 1; |
495 | v->no_cachable = 0; | |
495 | v->no_cacheable = 0; | |
496 | 496 | v->not_found = 0; |
497 | 497 | |
498 | 498 | ngx_sprintf(v->data, "%V=%08XD%08XD%08XD%08XD", |
911 | 911 | if (value) { |
912 | 912 | vv->len = val.len; |
913 | 913 | vv->valid = 1; |
914 | vv->no_cachable = 0; | |
914 | vv->no_cacheable = 0; | |
915 | 915 | vv->not_found = 0; |
916 | 916 | vv->data = val.data; |
917 | 917 |
335 | 335 | if (value.data) { |
336 | 336 | v->len = value.len; |
337 | 337 | v->valid = 1; |
338 | v->no_cachable = 0; | |
338 | v->no_cacheable = 0; | |
339 | 339 | v->not_found = 0; |
340 | 340 | v->data = value.data; |
341 | 341 | |
953 | 953 | value[1].len--; |
954 | 954 | value[1].data++; |
955 | 955 | |
956 | v = ngx_http_add_variable(cf, &value[1], NGX_HTTP_VAR_CHANGABLE); | |
956 | v = ngx_http_add_variable(cf, &value[1], NGX_HTTP_VAR_CHANGEABLE); | |
957 | 957 | if (v == NULL) { |
958 | 958 | return NGX_CONF_ERROR; |
959 | 959 | } |
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | static int ngx_http_busy_lock_look_cachable(ngx_http_busy_lock_t *bl, | |
13 | ngx_http_busy_lock_ctx_t *bc, | |
14 | int lock); | |
12 | static int ngx_http_busy_lock_look_cacheable(ngx_http_busy_lock_t *bl, | |
13 | ngx_http_busy_lock_ctx_t *bc, | |
14 | int lock); | |
15 | 15 | |
16 | 16 | |
17 | 17 | int ngx_http_busy_lock(ngx_http_busy_lock_t *bl, ngx_http_busy_lock_ctx_t *bc) |
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | int ngx_http_busy_lock_cachable(ngx_http_busy_lock_t *bl, | |
63 | ngx_http_busy_lock_ctx_t *bc, int lock) | |
62 | int ngx_http_busy_lock_cacheable(ngx_http_busy_lock_t *bl, | |
63 | ngx_http_busy_lock_ctx_t *bc, int lock) | |
64 | 64 | { |
65 | 65 | int rc; |
66 | 66 | |
67 | rc = ngx_http_busy_lock_look_cachable(bl, bc, lock); | |
67 | rc = ngx_http_busy_lock_look_cacheable(bl, bc, lock); | |
68 | 68 | |
69 | 69 | ngx_log_debug3(NGX_LOG_DEBUG_HTTP, bc->event->log, 0, |
70 | 70 | "http busylock: %d w:%d mw::%d", |
120 | 120 | |
121 | 121 | if (bl->md5) { |
122 | 122 | bl->md5_mask[bc->slot / 8] &= ~(1 << (bc->slot & 7)); |
123 | bl->cachable--; | |
123 | bl->cacheable--; | |
124 | 124 | } |
125 | 125 | |
126 | 126 | bl->busy--; |
127 | 127 | } |
128 | 128 | |
129 | 129 | |
130 | static int ngx_http_busy_lock_look_cachable(ngx_http_busy_lock_t *bl, | |
131 | ngx_http_busy_lock_ctx_t *bc, | |
132 | int lock) | |
133 | { | |
134 | int i, b, cachable, free; | |
130 | static int ngx_http_busy_lock_look_cacheable(ngx_http_busy_lock_t *bl, | |
131 | ngx_http_busy_lock_ctx_t *bc, | |
132 | int lock) | |
133 | { | |
134 | int i, b, cacheable, free; | |
135 | 135 | u_int mask; |
136 | 136 | |
137 | 137 | b = 0; |
138 | cachable = 0; | |
138 | cacheable = 0; | |
139 | 139 | free = -1; |
140 | 140 | |
141 | 141 | #if (NGX_SUPPRESS_WARN) |
152 | 152 | if (ngx_memcmp(&bl->md5[i * 16], bc->md5, 16) == 0) { |
153 | 153 | return NGX_AGAIN; |
154 | 154 | } |
155 | cachable++; | |
155 | cacheable++; | |
156 | 156 | |
157 | 157 | } else if (free == -1) { |
158 | 158 | free = i; |
159 | 159 | } |
160 | 160 | |
161 | 161 | #if 1 |
162 | if (cachable == bl->cachable) { | |
163 | if (free == -1 && cachable < bl->max_busy) { | |
162 | if (cacheable == bl->cacheable) { | |
163 | if (free == -1 && cacheable < bl->max_busy) { | |
164 | 164 | free = i + 1; |
165 | 165 | } |
166 | 166 | |
185 | 185 | bl->md5_mask[free / 8] |= 1 << (free & 7); |
186 | 186 | bc->slot = free; |
187 | 187 | |
188 | bl->cachable++; | |
188 | bl->cacheable++; | |
189 | 189 | bl->busy++; |
190 | 190 | } |
191 | 191 |
16 | 16 | typedef struct { |
17 | 17 | u_char *md5_mask; |
18 | 18 | char *md5; |
19 | int cachable; | |
19 | int cacheable; | |
20 | 20 | |
21 | 21 | int busy; |
22 | 22 | int max_busy; |
40 | 40 | |
41 | 41 | |
42 | 42 | int ngx_http_busy_lock(ngx_http_busy_lock_t *bl, ngx_http_busy_lock_ctx_t *bc); |
43 | int ngx_http_busy_lock_cachable(ngx_http_busy_lock_t *bl, | |
44 | ngx_http_busy_lock_ctx_t *bc, int lock); | |
43 | int ngx_http_busy_lock_cacheable(ngx_http_busy_lock_t *bl, | |
44 | ngx_http_busy_lock_ctx_t *bc, int lock); | |
45 | 45 | void ngx_http_busy_unlock(ngx_http_busy_lock_t *bl, |
46 | 46 | ngx_http_busy_lock_ctx_t *bc); |
47 | 47 |
448 | 448 | unsigned limit_zone_set:1; |
449 | 449 | |
450 | 450 | #if 0 |
451 | unsigned cachable:1; | |
451 | unsigned cacheable:1; | |
452 | 452 | #endif |
453 | 453 | |
454 | 454 | unsigned pipeline:1; |
313 | 313 | cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
314 | 314 | |
315 | 315 | for (i = 0; i < cmcf->variables.nelts; i++) { |
316 | if (r->variables[i].no_cachable) { | |
316 | if (r->variables[i].no_cacheable) { | |
317 | 317 | r->variables[i].valid = 0; |
318 | 318 | r->variables[i].not_found = 0; |
319 | 319 | } |
350 | 350 | |
351 | 351 | |
352 | 352 | void |
353 | ngx_http_script_flush_no_cachable_variables(ngx_http_request_t *r, | |
353 | ngx_http_script_flush_no_cacheable_variables(ngx_http_request_t *r, | |
354 | 354 | ngx_array_t *indices) |
355 | 355 | { |
356 | 356 | ngx_uint_t n, *index; |
358 | 358 | if (indices) { |
359 | 359 | index = indices->elts; |
360 | 360 | for (n = 0; n < indices->nelts; n++) { |
361 | if (r->variables[index[n]].no_cachable) { | |
361 | if (r->variables[index[n]].no_cacheable) { | |
362 | 362 | r->variables[index[n]].valid = 0; |
363 | 363 | r->variables[index[n]].not_found = 0; |
364 | 364 | } |
1151 | 1151 | |
1152 | 1152 | r->variables[code->index].len = e->sp->len; |
1153 | 1153 | r->variables[code->index].valid = 1; |
1154 | r->variables[code->index].no_cachable = 0; | |
1154 | r->variables[code->index].no_cacheable = 0; | |
1155 | 1155 | r->variables[code->index].not_found = 0; |
1156 | 1156 | r->variables[code->index].data = e->sp->data; |
1157 | 1157 | } |
180 | 180 | ngx_int_t ngx_http_script_compile(ngx_http_script_compile_t *sc); |
181 | 181 | u_char *ngx_http_script_run(ngx_http_request_t *r, ngx_str_t *value, |
182 | 182 | void *code_lengths, size_t reserved, void *code_values); |
183 | void ngx_http_script_flush_no_cachable_variables(ngx_http_request_t *r, | |
183 | void ngx_http_script_flush_no_cacheable_variables(ngx_http_request_t *r, | |
184 | 184 | ngx_array_t *indices); |
185 | 185 | |
186 | 186 | void *ngx_http_script_start_code(ngx_pool_t *pool, ngx_array_t **codes, |
433 | 433 | ev->error = 1; |
434 | 434 | } |
435 | 435 | |
436 | if (!u->cachable && !u->store && u->peer.connection) { | |
436 | if (!u->cacheable && !u->store && u->peer.connection) { | |
437 | 437 | ngx_log_error(NGX_LOG_INFO, ev->log, ev->kq_errno, |
438 | 438 | "kevent() reported that client closed prematurely " |
439 | 439 | "connection, so upstream connection is closed too"); |
499 | 499 | ev->eof = 1; |
500 | 500 | c->error = 1; |
501 | 501 | |
502 | if (!u->cachable && !u->store && u->peer.connection) { | |
502 | if (!u->cacheable && !u->store && u->peer.connection) { | |
503 | 503 | ngx_log_error(NGX_LOG_INFO, ev->log, err, |
504 | 504 | "client closed prematurely connection, " |
505 | 505 | "so upstream connection is closed too"); |
1512 | 1512 | } |
1513 | 1513 | } |
1514 | 1514 | |
1515 | if (u->cachable) { | |
1515 | if (u->cacheable) { | |
1516 | 1516 | header = (ngx_http_cache_header_t *) u->buffer->start; |
1517 | 1517 | |
1518 | 1518 | header->expires = u->cache->ctx.expires; |
1540 | 1540 | p->pool = r->pool; |
1541 | 1541 | p->log = c->log; |
1542 | 1542 | |
1543 | p->cachable = u->cachable || u->store; | |
1543 | p->cacheable = u->cacheable || u->store; | |
1544 | 1544 | |
1545 | 1545 | p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); |
1546 | 1546 | if (p->temp_file == NULL) { |
1553 | 1553 | p->temp_file->path = u->conf->temp_path; |
1554 | 1554 | p->temp_file->pool = r->pool; |
1555 | 1555 | |
1556 | if (u->cachable || u->store) { | |
1556 | if (u->cacheable || u->store) { | |
1557 | 1557 | p->temp_file->persistent = 1; |
1558 | 1558 | |
1559 | 1559 | } else { |
1577 | 1577 | |
1578 | 1578 | p->preread_size = u->buffer.last - u->buffer.pos; |
1579 | 1579 | |
1580 | if (u->cachable) { | |
1580 | if (u->cacheable) { | |
1581 | 1581 | |
1582 | 1582 | p->buf_to_file = ngx_calloc_buf(r->pool); |
1583 | 1583 | if (p->buf_to_file == NULL) { |
1954 | 1954 | |
1955 | 1955 | #if (NGX_HTTP_FILE_CACHE) |
1956 | 1956 | |
1957 | if (p->upstream_done && u->cachable) { | |
1957 | if (p->upstream_done && u->cacheable) { | |
1958 | 1958 | if (ngx_http_cache_update(r) == NGX_ERROR) { |
1959 | 1959 | ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); |
1960 | 1960 | ngx_http_upstream_finalize_request(r, u, 0); |
1961 | 1961 | return; |
1962 | 1962 | } |
1963 | 1963 | |
1964 | } else if (p->upstream_eof && u->cachable) { | |
1964 | } else if (p->upstream_eof && u->cacheable) { | |
1965 | 1965 | |
1966 | 1966 | /* TODO: check length & update cache */ |
1967 | 1967 | |
1989 | 1989 | ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
1990 | 1990 | "http upstream downstream error"); |
1991 | 1991 | |
1992 | if (!u->cachable && u->peer.connection) { | |
1992 | if (!u->cacheable && u->peer.connection) { | |
1993 | 1993 | ngx_http_upstream_finalize_request(r, u, 0); |
1994 | 1994 | } |
1995 | 1995 | } |
2713 | 2713 | ngx_http_upstream_state_t *state; |
2714 | 2714 | |
2715 | 2715 | v->valid = 1; |
2716 | v->no_cachable = 0; | |
2716 | v->no_cacheable = 0; | |
2717 | 2717 | v->not_found = 0; |
2718 | 2718 | |
2719 | 2719 | if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2784 | 2784 | ngx_http_upstream_state_t *state; |
2785 | 2785 | |
2786 | 2786 | v->valid = 1; |
2787 | v->no_cachable = 0; | |
2787 | v->no_cacheable = 0; | |
2788 | 2788 | v->not_found = 0; |
2789 | 2789 | |
2790 | 2790 | if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2850 | 2850 | ngx_http_upstream_state_t *state; |
2851 | 2851 | |
2852 | 2852 | v->valid = 1; |
2853 | v->no_cachable = 0; | |
2853 | v->no_cacheable = 0; | |
2854 | 2854 | v->not_found = 0; |
2855 | 2855 | |
2856 | 2856 | if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
243 | 243 | ngx_http_cleanup_pt *cleanup; |
244 | 244 | |
245 | 245 | unsigned store:1; |
246 | unsigned cachable:1; | |
246 | unsigned cacheable:1; | |
247 | 247 | unsigned accel:1; |
248 | 248 | |
249 | 249 | unsigned buffering:1; |
142 | 142 | |
143 | 143 | { ngx_string("uri"), NULL, ngx_http_variable_request, |
144 | 144 | offsetof(ngx_http_request_t, uri), |
145 | NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
145 | NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
146 | 146 | |
147 | 147 | { ngx_string("document_uri"), NULL, ngx_http_variable_request, |
148 | 148 | offsetof(ngx_http_request_t, uri), |
149 | NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
149 | NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
150 | 150 | |
151 | 151 | { ngx_string("request"), NULL, ngx_http_variable_request, |
152 | 152 | offsetof(ngx_http_request_t, request_line), 0, 0 }, |
153 | 153 | |
154 | 154 | { ngx_string("document_root"), NULL, |
155 | ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
155 | ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
156 | 156 | |
157 | 157 | { ngx_string("query_string"), NULL, ngx_http_variable_request, |
158 | 158 | offsetof(ngx_http_request_t, args), |
159 | NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
159 | NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
160 | 160 | |
161 | 161 | { ngx_string("args"), |
162 | 162 | ngx_http_variable_request_set, |
163 | 163 | ngx_http_variable_request, |
164 | 164 | offsetof(ngx_http_request_t, args), |
165 | NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
165 | NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
166 | 166 | |
167 | 167 | { ngx_string("is_args"), NULL, ngx_http_variable_is_args, |
168 | 0, NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
168 | 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
169 | 169 | |
170 | 170 | { ngx_string("request_filename"), NULL, |
171 | 171 | ngx_http_variable_request_filename, 0, |
172 | NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
172 | NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
173 | 173 | |
174 | 174 | { ngx_string("server_name"), NULL, ngx_http_variable_request, |
175 | 175 | offsetof(ngx_http_request_t, server_name), 0, 0 }, |
214 | 214 | { ngx_string("limit_rate"), ngx_http_variable_request_set_size, |
215 | 215 | ngx_http_variable_request, |
216 | 216 | offsetof(ngx_http_request_t, limit_rate), |
217 | NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 }, | |
217 | NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE, 0 }, | |
218 | 218 | |
219 | 219 | { ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version, |
220 | 220 | 0, 0, 0 }, |
250 | 250 | |
251 | 251 | v = key[i].value; |
252 | 252 | |
253 | if (!(v->flags & NGX_HTTP_VAR_CHANGABLE)) { | |
253 | if (!(v->flags & NGX_HTTP_VAR_CHANGEABLE)) { | |
254 | 254 | ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
255 | 255 | "the duplicate \"%V\" variable", name); |
256 | 256 | return NULL; |
374 | 374 | if (v[index].get_handler(r, &r->variables[index], v[index].data) |
375 | 375 | == NGX_OK) |
376 | 376 | { |
377 | if (v[index].flags & NGX_HTTP_VAR_NOCACHABLE) { | |
378 | r->variables[index].no_cachable = 1; | |
377 | if (v[index].flags & NGX_HTTP_VAR_NOCACHEABLE) { | |
378 | r->variables[index].no_cacheable = 1; | |
379 | 379 | } |
380 | 380 | |
381 | 381 | return &r->variables[index]; |
396 | 396 | v = &r->variables[index]; |
397 | 397 | |
398 | 398 | if (v->valid) { |
399 | if (!v->no_cachable) { | |
399 | if (!v->no_cacheable) { | |
400 | 400 | return v; |
401 | 401 | } |
402 | 402 | |
496 | 496 | if (s->data) { |
497 | 497 | v->len = s->len; |
498 | 498 | v->valid = 1; |
499 | v->no_cachable = 0; | |
499 | v->no_cacheable = 0; | |
500 | 500 | v->not_found = 0; |
501 | 501 | v->data = s->data; |
502 | 502 | |
558 | 558 | if (h) { |
559 | 559 | v->len = h->value.len; |
560 | 560 | v->valid = 1; |
561 | v->no_cachable = 0; | |
561 | v->no_cacheable = 0; | |
562 | 562 | v->not_found = 0; |
563 | 563 | v->data = h->value.data; |
564 | 564 | |
590 | 590 | } |
591 | 591 | |
592 | 592 | v->valid = 1; |
593 | v->no_cachable = 0; | |
593 | v->no_cacheable = 0; | |
594 | 594 | v->not_found = 0; |
595 | 595 | |
596 | 596 | h = a->elts; |
690 | 690 | if (n + prefix == var->len && n == header[i].key.len) { |
691 | 691 | v->len = header[i].value.len; |
692 | 692 | v->valid = 1; |
693 | v->no_cachable = 0; | |
693 | v->no_cacheable = 0; | |
694 | 694 | v->not_found = 0; |
695 | 695 | v->data = header[i].value.data; |
696 | 696 | |
729 | 729 | } |
730 | 730 | |
731 | 731 | v->valid = 1; |
732 | v->no_cachable = 0; | |
732 | v->no_cacheable = 0; | |
733 | 733 | v->not_found = 0; |
734 | 734 | |
735 | 735 | return NGX_OK; |
748 | 748 | |
749 | 749 | v->len = sizeof(in_addr_t); |
750 | 750 | v->valid = 1; |
751 | v->no_cachable = 0; | |
751 | v->no_cacheable = 0; | |
752 | 752 | v->not_found = 0; |
753 | 753 | v->data = (u_char *) &sin->sin_addr.s_addr; |
754 | 754 | |
762 | 762 | { |
763 | 763 | v->len = r->connection->addr_text.len; |
764 | 764 | v->valid = 1; |
765 | v->no_cachable = 0; | |
765 | v->no_cacheable = 0; | |
766 | 766 | v->not_found = 0; |
767 | 767 | v->data = r->connection->addr_text.data; |
768 | 768 | |
779 | 779 | |
780 | 780 | v->len = 0; |
781 | 781 | v->valid = 1; |
782 | v->no_cachable = 0; | |
782 | v->no_cacheable = 0; | |
783 | 783 | v->not_found = 0; |
784 | 784 | |
785 | 785 | v->data = ngx_palloc(r->pool, sizeof("65535") - 1); |
831 | 831 | v->len = ngx_inet_ntop(c->listening->family, &r->in_addr, |
832 | 832 | v->data, INET_ADDRSTRLEN); |
833 | 833 | v->valid = 1; |
834 | v->no_cachable = 0; | |
834 | v->no_cacheable = 0; | |
835 | 835 | v->not_found = 0; |
836 | 836 | |
837 | 837 | return NGX_OK; |
844 | 844 | { |
845 | 845 | v->len = r->port_text->len - 1; |
846 | 846 | v->valid = 1; |
847 | v->no_cachable = 0; | |
847 | v->no_cacheable = 0; | |
848 | 848 | v->not_found = 0; |
849 | 849 | v->data = r->port_text->data + 1; |
850 | 850 | |
861 | 861 | if (r->connection->ssl) { |
862 | 862 | v->len = sizeof("https") - 1; |
863 | 863 | v->valid = 1; |
864 | v->no_cachable = 0; | |
864 | v->no_cacheable = 0; | |
865 | 865 | v->not_found = 0; |
866 | 866 | v->data = (u_char *) "https"; |
867 | 867 | |
872 | 872 | |
873 | 873 | v->len = sizeof("http") - 1; |
874 | 874 | v->valid = 1; |
875 | v->no_cachable = 0; | |
875 | v->no_cacheable = 0; | |
876 | 876 | v->not_found = 0; |
877 | 877 | v->data = (u_char *) "http"; |
878 | 878 | |
885 | 885 | ngx_http_variable_value_t *v, uintptr_t data) |
886 | 886 | { |
887 | 887 | v->valid = 1; |
888 | v->no_cachable = 0; | |
888 | v->no_cacheable = 0; | |
889 | 889 | v->not_found = 0; |
890 | 890 | |
891 | 891 | if (r->args.len == 0) { |
913 | 913 | if (clcf->root_lengths == NULL) { |
914 | 914 | v->len = clcf->root.len; |
915 | 915 | v->valid = 1; |
916 | v->no_cachable = 0; | |
916 | v->no_cacheable = 0; | |
917 | 917 | v->not_found = 0; |
918 | 918 | v->data = clcf->root.data; |
919 | 919 | |
933 | 933 | |
934 | 934 | v->len = path.len; |
935 | 935 | v->valid = 1; |
936 | v->no_cachable = 0; | |
936 | v->no_cacheable = 0; | |
937 | 937 | v->not_found = 0; |
938 | 938 | v->data = path.data; |
939 | 939 | } |
957 | 957 | |
958 | 958 | v->len = path.len - 1; |
959 | 959 | v->valid = 1; |
960 | v->no_cachable = 0; | |
960 | v->no_cacheable = 0; | |
961 | 961 | v->not_found = 0; |
962 | 962 | v->data = path.data; |
963 | 963 | |
972 | 972 | if (r->main->method_name.data) { |
973 | 973 | v->len = r->main->method_name.len; |
974 | 974 | v->valid = 1; |
975 | v->no_cachable = 0; | |
975 | v->no_cacheable = 0; | |
976 | 976 | v->not_found = 0; |
977 | 977 | v->data = r->main->method_name.data; |
978 | 978 | |
1003 | 1003 | |
1004 | 1004 | v->len = r->headers_in.user.len; |
1005 | 1005 | v->valid = 1; |
1006 | v->no_cachable = 0; | |
1006 | v->no_cacheable = 0; | |
1007 | 1007 | v->not_found = 0; |
1008 | 1008 | v->data = r->headers_in.user.data; |
1009 | 1009 | |
1031 | 1031 | |
1032 | 1032 | v->len = ngx_sprintf(p, "%O", sent) - p; |
1033 | 1033 | v->valid = 1; |
1034 | v->no_cachable = 0; | |
1034 | v->no_cacheable = 0; | |
1035 | 1035 | v->not_found = 0; |
1036 | 1036 | v->data = p; |
1037 | 1037 | |
1046 | 1046 | if (r->headers_out.content_type.len) { |
1047 | 1047 | v->len = r->headers_out.content_type.len; |
1048 | 1048 | v->valid = 1; |
1049 | v->no_cachable = 0; | |
1049 | v->no_cacheable = 0; | |
1050 | 1050 | v->not_found = 0; |
1051 | 1051 | v->data = r->headers_out.content_type.data; |
1052 | 1052 | |
1067 | 1067 | if (r->headers_out.content_length) { |
1068 | 1068 | v->len = r->headers_out.content_length->value.len; |
1069 | 1069 | v->valid = 1; |
1070 | v->no_cachable = 0; | |
1070 | v->no_cacheable = 0; | |
1071 | 1071 | v->not_found = 0; |
1072 | 1072 | v->data = r->headers_out.content_length->value.data; |
1073 | 1073 | |
1082 | 1082 | |
1083 | 1083 | v->len = ngx_sprintf(p, "%O", r->headers_out.content_length_n) - p; |
1084 | 1084 | v->valid = 1; |
1085 | v->no_cachable = 0; | |
1085 | v->no_cacheable = 0; | |
1086 | 1086 | v->not_found = 0; |
1087 | 1087 | v->data = p; |
1088 | 1088 | |
1104 | 1104 | if (r->headers_out.last_modified) { |
1105 | 1105 | v->len = r->headers_out.last_modified->value.len; |
1106 | 1106 | v->valid = 1; |
1107 | v->no_cachable = 0; | |
1107 | v->no_cacheable = 0; | |
1108 | 1108 | v->not_found = 0; |
1109 | 1109 | v->data = r->headers_out.last_modified->value.data; |
1110 | 1110 | |
1120 | 1120 | |
1121 | 1121 | v->len = ngx_http_time(p, r->headers_out.last_modified_time) - p; |
1122 | 1122 | v->valid = 1; |
1123 | v->no_cachable = 0; | |
1123 | v->no_cacheable = 0; | |
1124 | 1124 | v->not_found = 0; |
1125 | 1125 | v->data = p; |
1126 | 1126 | |
1151 | 1151 | |
1152 | 1152 | v->len = len; |
1153 | 1153 | v->valid = 1; |
1154 | v->no_cachable = 0; | |
1154 | v->no_cacheable = 0; | |
1155 | 1155 | v->not_found = 0; |
1156 | 1156 | v->data = (u_char *) p; |
1157 | 1157 | |
1178 | 1178 | |
1179 | 1179 | v->len = ngx_sprintf(p, "timeout=%T", clcf->keepalive_header) - p; |
1180 | 1180 | v->valid = 1; |
1181 | v->no_cachable = 0; | |
1181 | v->no_cacheable = 0; | |
1182 | 1182 | v->not_found = 0; |
1183 | 1183 | v->data = p; |
1184 | 1184 | |
1199 | 1199 | if (r->chunked) { |
1200 | 1200 | v->len = sizeof("chunked") - 1; |
1201 | 1201 | v->valid = 1; |
1202 | v->no_cachable = 0; | |
1202 | v->no_cacheable = 0; | |
1203 | 1203 | v->not_found = 0; |
1204 | 1204 | v->data = (u_char *) "chunked"; |
1205 | 1205 | |
1218 | 1218 | if (r->request_complete) { |
1219 | 1219 | v->len = 2; |
1220 | 1220 | v->valid = 1; |
1221 | v->no_cachable = 0; | |
1221 | v->no_cacheable = 0; | |
1222 | 1222 | v->not_found = 0; |
1223 | 1223 | v->data = (u_char *) "OK"; |
1224 | 1224 | |
1227 | 1227 | |
1228 | 1228 | v->len = 0; |
1229 | 1229 | v->valid = 1; |
1230 | v->no_cachable = 0; | |
1230 | v->no_cacheable = 0; | |
1231 | 1231 | v->not_found = 0; |
1232 | 1232 | v->data = (u_char *) ""; |
1233 | 1233 | |
1247 | 1247 | |
1248 | 1248 | v->len = r->request_body->temp_file->file.name.len; |
1249 | 1249 | v->valid = 1; |
1250 | v->no_cachable = 0; | |
1250 | v->no_cacheable = 0; | |
1251 | 1251 | v->not_found = 0; |
1252 | 1252 | v->data = r->request_body->temp_file->file.name.data; |
1253 | 1253 | |
1261 | 1261 | { |
1262 | 1262 | v->len = sizeof(NGINX_VERSION) - 1; |
1263 | 1263 | v->valid = 1; |
1264 | v->no_cachable = 0; | |
1264 | v->no_cacheable = 0; | |
1265 | 1265 | v->not_found = 0; |
1266 | 1266 | v->data = (u_char *) NGINX_VERSION; |
1267 | 1267 | |
1369 | 1369 | if (ngx_strncmp(v[i].name.data, "upstream_http_", 14) == 0) { |
1370 | 1370 | v[i].get_handler = ngx_http_upstream_header_variable; |
1371 | 1371 | v[i].data = (uintptr_t) &v[i].name; |
1372 | v[i].flags = NGX_HTTP_VAR_NOCACHABLE; | |
1372 | v[i].flags = NGX_HTTP_VAR_NOCACHEABLE; | |
1373 | 1373 | |
1374 | 1374 | continue; |
1375 | 1375 | } |
25 | 25 | ngx_http_variable_value_t *v, uintptr_t data); |
26 | 26 | |
27 | 27 | |
28 | #define NGX_HTTP_VAR_CHANGABLE 1 | |
29 | #define NGX_HTTP_VAR_NOCACHABLE 2 | |
30 | #define NGX_HTTP_VAR_INDEXED 4 | |
31 | #define NGX_HTTP_VAR_NOHASH 8 | |
28 | #define NGX_HTTP_VAR_CHANGEABLE 1 | |
29 | #define NGX_HTTP_VAR_NOCACHEABLE 2 | |
30 | #define NGX_HTTP_VAR_INDEXED 4 | |
31 | #define NGX_HTTP_VAR_NOHASH 8 | |
32 | 32 | |
33 | 33 | |
34 | 34 | struct ngx_http_variable_s { |
13 | 13 | ngx_int_t type); |
14 | 14 | static void ngx_start_garbage_collector(ngx_cycle_t *cycle, ngx_int_t type); |
15 | 15 | static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo); |
16 | static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle); | |
16 | static ngx_uint_t ngx_reap_children(ngx_cycle_t *cycle); | |
17 | 17 | static void ngx_master_process_exit(ngx_cycle_t *cycle); |
18 | 18 | static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); |
19 | 19 | static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority); |
156 | 156 | |
157 | 157 | if (ngx_reap) { |
158 | 158 | ngx_reap = 0; |
159 | ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "reap childs"); | |
160 | ||
161 | live = ngx_reap_childs(cycle); | |
159 | ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "reap children"); | |
160 | ||
161 | live = ngx_reap_children(cycle); | |
162 | 162 | } |
163 | 163 | |
164 | 164 | if (!live && (ngx_terminate || ngx_quit)) { |
495 | 495 | |
496 | 496 | |
497 | 497 | static ngx_uint_t |
498 | ngx_reap_childs(ngx_cycle_t *cycle) | |
498 | ngx_reap_children(ngx_cycle_t *cycle) | |
499 | 499 | { |
500 | 500 | ngx_int_t i, n; |
501 | 501 | ngx_uint_t live; |