Mercurial > hg > nginx
comparison src/http/modules/ngx_http_stub_status_module.c @ 495:fc9909c369b2 release-0.1.22
nginx-0.1.22-RELEASE import
*) Bugfix: the ngx_http_stub_status_module showed incorrect handled
connections statistics if the proxying or FastCGI server were used.
*) Bugfix: the installation paths were incorrectly quoted on Linux and
Solaris; the bug had appeared in 0.1.21.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 24 Feb 2005 12:29:09 +0000 |
parents | 975f62e77f02 |
children | d4ea69372b94 |
comparison
equal
deleted
inserted
replaced
494:f94c1b769a7c | 495:fc9909c369b2 |
---|---|
45 }; | 45 }; |
46 | 46 |
47 | 47 |
48 static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r) | 48 static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r) |
49 { | 49 { |
50 size_t size; | 50 size_t size; |
51 ngx_int_t rc; | 51 ngx_int_t rc; |
52 uint32_t ap, hn, ac, rq, rd, wr; | 52 ngx_buf_t *b; |
53 ngx_buf_t *b; | 53 ngx_chain_t out; |
54 ngx_chain_t out; | 54 ngx_atomic_int_t ap, hn, ac, rq, rd, wr; |
55 | 55 |
56 if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) { | 56 if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) { |
57 return NGX_HTTP_NOT_ALLOWED; | 57 return NGX_HTTP_NOT_ALLOWED; |
58 } | 58 } |
59 | 59 |
81 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { | 81 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { |
82 return rc; | 82 return rc; |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 size = sizeof("Active connections: \n") + NGX_INT32_LEN | 86 size = sizeof("Active connections: \n") + NGX_ATOMIC_T_LEN |
87 + sizeof("server accepts handled requests\n") - 1 | 87 + sizeof("server accepts handled requests\n") - 1 |
88 + 6 + 3 * NGX_INT32_LEN | 88 + 6 + 3 * NGX_ATOMIC_T_LEN |
89 + sizeof("Reading: Writing: Waiting: \n") + 3 * NGX_INT32_LEN; | 89 + sizeof("Reading: Writing: Waiting: \n") + 3 * NGX_ATOMIC_T_LEN; |
90 | 90 |
91 if (!(b = ngx_create_temp_buf(r->pool, size))) { | 91 if (!(b = ngx_create_temp_buf(r->pool, size))) { |
92 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 92 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
93 } | 93 } |
94 | 94 |
95 out.buf = b; | 95 out.buf = b; |
96 out.next = NULL; | 96 out.next = NULL; |
97 | 97 |
98 ap = *ngx_stat_accepted; | 98 ap = *ngx_stat_accepted; |
99 hn = *ngx_connection_counter; | 99 hn = *ngx_stat_handled; |
100 ac = *ngx_stat_active; | 100 ac = *ngx_stat_active; |
101 rq = *ngx_stat_requests; | 101 rq = *ngx_stat_requests; |
102 rd = *ngx_stat_reading; | 102 rd = *ngx_stat_reading; |
103 wr = *ngx_stat_writing; | 103 wr = *ngx_stat_writing; |
104 | 104 |
105 b->last = ngx_sprintf(b->last, "Active connections: %D \n", ac); | 105 b->last = ngx_sprintf(b->last, "Active connections: %A \n", ac); |
106 | 106 |
107 b->last = ngx_cpymem(b->last, "server accepts handled requests\n", | 107 b->last = ngx_cpymem(b->last, "server accepts handled requests\n", |
108 sizeof("server accepts handled requests\n") - 1); | 108 sizeof("server accepts handled requests\n") - 1); |
109 | 109 |
110 b->last = ngx_sprintf(b->last, " %D %D %D \n", ap, hn, rq); | 110 b->last = ngx_sprintf(b->last, " %A %A %A \n", ap, hn, rq); |
111 | 111 |
112 b->last = ngx_sprintf(b->last, "Reading: %D Writing: %D Waiting: %d \n", | 112 b->last = ngx_sprintf(b->last, "Reading: %A Writing: %A Waiting: %A \n", |
113 rd, wr, ac - (rd + wr)); | 113 rd, wr, ac - (rd + wr)); |
114 | 114 |
115 r->headers_out.status = NGX_HTTP_OK; | 115 r->headers_out.status = NGX_HTTP_OK; |
116 r->headers_out.content_length_n = b->last - b->pos; | 116 r->headers_out.content_length_n = b->last - b->pos; |
117 | 117 |