comparison src/http/modules/ngx_http_fastcgi_module.c @ 7220:20f139e9ffa8

Generic subrequests in memory. Previously, only the upstream response body could be accessed with the NGX_HTTP_SUBREQUEST_IN_MEMORY feature. Now any response body from a subrequest can be saved in a memory buffer. It is available as a single buffer in r->out and the buffer size is configured by the subrequest_output_buffer_size directive. Upstream, proxy and fastcgi code used to handle the old-style feature is removed.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 28 Feb 2018 16:56:58 +0300
parents 3b635e8fd499
children 06cf0c4b8618
comparison
equal deleted inserted replaced
7219:d0d32b33167d 7220:20f139e9ffa8
2510 b->last = f->last; 2510 b->last = f->last;
2511 2511
2512 break; 2512 break;
2513 } 2513 }
2514 2514
2515 /* provide continuous buffer for subrequests in memory */
2516
2517 if (r->subrequest_in_memory) {
2518
2519 cl = u->out_bufs;
2520
2521 if (cl) {
2522 buf->pos = cl->buf->pos;
2523 }
2524
2525 buf->last = buf->pos;
2526
2527 for (cl = u->out_bufs; cl; cl = cl->next) {
2528 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2529 "http fastcgi in memory %p-%p %O",
2530 cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf));
2531
2532 if (buf->last == cl->buf->pos) {
2533 buf->last = cl->buf->last;
2534 continue;
2535 }
2536
2537 buf->last = ngx_movemem(buf->last, cl->buf->pos,
2538 cl->buf->last - cl->buf->pos);
2539
2540 cl->buf->pos = buf->last - (cl->buf->last - cl->buf->pos);
2541 cl->buf->last = buf->last;
2542 }
2543 }
2544
2545 return NGX_OK; 2515 return NGX_OK;
2546 } 2516 }
2547 2517
2548 2518
2549 static ngx_int_t 2519 static ngx_int_t