Support extended status reports in stub_status module
Grzegorz Nosek
root at localdomain.pl
Sun Jun 29 21:42:21 MSD 2008
---
src/http/modules/ngx_http_stub_status_module.c | 38 ++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/http/modules/ngx_http_stub_status_module.c b/src/http/modules/ngx_http_stub_status_module.c
index cc1fd51..d163ab7 100644
--- a/src/http/modules/ngx_http_stub_status_module.c
+++ b/src/http/modules/ngx_http_stub_status_module.c
@@ -66,6 +66,11 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
ngx_buf_t *b;
ngx_chain_t out;
ngx_atomic_int_t ap, hn, ac, rq, rd, wr;
+#if (NGX_HTTP_EXTENDED_STATUS)
+ ngx_int_t i;
+ ngx_chain_t *tail;
+ ngx_chain_t *mod_status;
+#endif
if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
return NGX_HTTP_NOT_ALLOWED;
@@ -125,6 +130,39 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
b->last_buf = 1;
+#if (NGX_HTTP_EXTENDED_STATUS)
+ tail = &out;
+
+ for (i=0; ngx_modules[i]; i++) {
+ ngx_http_module_t *ctx;
+ ngx_int_t length;
+
+ if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
+ continue;
+ }
+
+ ctx = (ngx_http_module_t *) ngx_modules[i]->ctx;
+ if (!ctx || !ctx->report_status) {
+ continue;
+ }
+
+ length = 0;
+ mod_status = ctx->report_status(r, &length);
+ if (mod_status) {
+ tail->next = mod_status;
+ tail->buf->last_buf = 0;
+
+ tail = mod_status;
+
+ if (!length) {
+ length = mod_status->buf->last - mod_status->buf->pos;
+ }
+
+ r->headers_out.content_length_n += length;
+ }
+ }
+#endif
+
rc = ngx_http_send_header(r);
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
--
1.5.4.4
--xHFwDpU9dbj6ez1V
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="0001-with-extended-status-support-in-upstream_fair.patch"
More information about the nginx
mailing list