Mercurial > hg > nginx
diff src/http/ngx_http_postpone_filter_module.c @ 583:4e296b7d25bf release-0.3.13
nginx-0.3.13-RELEASE import
*) Feature: the IMAP/POP3 proxy supports STARTTLS and STLS.
*) Bugfix: the IMAP/POP3 proxy did not work with the select, poll, and
/dev/poll methods.
*) Bugfix: in SSI handling.
*) Bugfix: now Solaris sendfilev() is not used to transfer the client
request body to FastCGI-server via the unix domain socket.
*) Bugfix: the "auth_basic" directive did not disable the
authorization; the bug had appeared in 0.3.11.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 05 Dec 2005 13:18:09 +0000 |
parents | 174f1e853e1e |
children | ebc68d8ca496 |
line wrap: on
line diff
--- a/src/http/ngx_http_postpone_filter_module.c +++ b/src/http/ngx_http_postpone_filter_module.c @@ -9,6 +9,8 @@ #include <ngx_http.h> +static ngx_int_t + ngx_http_postpone_filter_output_postponed_request(ngx_http_request_t *r); static ngx_int_t ngx_http_postpone_filter_init(ngx_cycle_t *cycle); @@ -53,8 +55,8 @@ ngx_http_postpone_filter(ngx_http_reques ngx_chain_t *out; ngx_http_postponed_request_t *pr, **ppr; - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http postpone filter \"%V\" %p", &r->uri, in); + ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http postpone filter \"%V?%V\" %p", &r->uri, &r->args, in); if (r != r->connection->data || (r->postponed && in)) { @@ -104,14 +106,25 @@ ngx_http_postpone_filter(ngx_http_reques return NGX_OK; } - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http postpone filter out \"%V\"", &r->uri); + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http postpone filter out \"%V?%V\"", &r->uri, &r->args); rc = ngx_http_next_filter(r->main, out); if (rc == NGX_ERROR) { /* NGX_ERROR may be returned by any filter */ - r->connection->closed = 1; + r->connection->error = 1; + } + + if (r->postponed == NULL) { + return rc; + } + + rc = ngx_http_postpone_filter_output_postponed_request(r); + + if (rc == NGX_ERROR) { + /* NGX_ERROR may be returned by any filter */ + r->connection->error = 1; } return rc; @@ -119,6 +132,55 @@ ngx_http_postpone_filter(ngx_http_reques static ngx_int_t +ngx_http_postpone_filter_output_postponed_request(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_http_postponed_request_t *pr; + + for ( ;; ) { + pr = r->postponed; + + if (pr == NULL) { + return NGX_OK; + } + + if (pr->request) { + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http postpone filter handle \"%V?%V\"", + &pr->request->uri, &pr->request->args); + + if (!pr->request->done) { + r->connection->data = pr->request; + return NGX_AGAIN; + } + + rc = ngx_http_postpone_filter_output_postponed_request(pr->request); + + if (rc == NGX_AGAIN || rc == NGX_ERROR) { + return rc; + } + + r->postponed = r->postponed->next; + pr = r->postponed; + } + + if (pr->out) { + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http postpone filter out postponed \"%V?%V\"", + &r->uri, &r->args); + + if (ngx_http_next_filter(r->main, pr->out) == NGX_ERROR) { + return NGX_ERROR; + } + } + + r->postponed = r->postponed->next; + } +} + + +static ngx_int_t ngx_http_postpone_filter_init(ngx_cycle_t *cycle) { ngx_http_next_filter = ngx_http_top_body_filter;