Mercurial > hg > nginx-vendor-current
comparison src/http/ngx_http_write_filter_module.c @ 216:fa32d59d9a15 NGINX_0_3_55
nginx 0.3.55
*) Feature: the "stub" parameter in the "include" SSI command.
*) Feature: the "block" SSI command.
*) Feature: the unicode2nginx script was added to contrib.
*) Bugfix: if a "root" was specified by variable only, then the root
was relative to a server prefix.
*) Bugfix: if the request contained "//" or "/./" and escaped symbols
after them, then the proxied request was sent unescaped.
*) Bugfix: the $r->headers_in("Cookie") of the ngx_http_perl_module now
returns all "Cookie" header lines.
*) Bugfix: a segmentation fault occurred if
"client_body_in_file_only on" was used and nginx switched to a next
upstream.
*) Bugfix: on some condition while reconfiguration character codes
inside the "charset_map" may be treated invalid; bug appeared in
0.3.50.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 28 Jul 2006 00:00:00 +0400 |
parents | 14050d2bec9b |
children | 38e7b94d63ac |
comparison
equal
deleted
inserted
replaced
215:84a7f4bc1133 | 216:fa32d59d9a15 |
---|---|
11 | 11 |
12 | 12 |
13 static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle); | 13 static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle); |
14 | 14 |
15 | 15 |
16 ngx_http_module_t ngx_http_write_filter_module_ctx = { | 16 static ngx_http_module_t ngx_http_write_filter_module_ctx = { |
17 NULL, /* preconfiguration */ | 17 NULL, /* preconfiguration */ |
18 NULL, /* postconfiguration */ | 18 NULL, /* postconfiguration */ |
19 | 19 |
20 NULL, /* create main configuration */ | 20 NULL, /* create main configuration */ |
21 NULL, /* init main configuration */ | 21 NULL, /* init main configuration */ |
67 /* find the size, the flush point and the last link of the saved chain */ | 67 /* find the size, the flush point and the last link of the saved chain */ |
68 | 68 |
69 for (cl = r->out; cl; cl = cl->next) { | 69 for (cl = r->out; cl; cl = cl->next) { |
70 ll = &cl->next; | 70 ll = &cl->next; |
71 | 71 |
72 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, | 72 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, c->log, 0, |
73 "write old buf t:%d f:%d %p, pos %p, size: %z " | 73 "write old buf t:%d f:%d %p, pos %p, size: %z " |
74 "file: %O, size: %z", | 74 "file: %O, size: %z", |
75 cl->buf->temporary, cl->buf->in_file, | 75 cl->buf->temporary, cl->buf->in_file, |
76 cl->buf->start, cl->buf->pos, | 76 cl->buf->start, cl->buf->pos, |
77 cl->buf->last - cl->buf->pos, | 77 cl->buf->last - cl->buf->pos, |
78 cl->buf->file_pos, | 78 cl->buf->file_pos, |
79 cl->buf->file_last - cl->buf->file_pos); | 79 cl->buf->file_last - cl->buf->file_pos); |
80 | 80 |
81 #if 1 | 81 #if 1 |
82 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) { | 82 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) { |
83 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | 83 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
84 "zero size buf in writer " | 84 "zero size buf in writer " |
85 "t:%d r:%d f:%d %p %p-%p %p %O-%O", | 85 "t:%d r:%d f:%d %p %p-%p %p %O-%O", |
86 cl->buf->temporary, | 86 cl->buf->temporary, |
87 cl->buf->recycled, | 87 cl->buf->recycled, |
88 cl->buf->in_file, | 88 cl->buf->in_file, |
119 | 119 |
120 cl->buf = ln->buf; | 120 cl->buf = ln->buf; |
121 *ll = cl; | 121 *ll = cl; |
122 ll = &cl->next; | 122 ll = &cl->next; |
123 | 123 |
124 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, | 124 ngx_log_debug7(NGX_LOG_DEBUG_EVENT, c->log, 0, |
125 "write new buf t:%d f:%d %p, pos %p, size: %z " | 125 "write new buf t:%d f:%d %p, pos %p, size: %z " |
126 "file: %O, size: %z", | 126 "file: %O, size: %z", |
127 cl->buf->temporary, cl->buf->in_file, | 127 cl->buf->temporary, cl->buf->in_file, |
128 cl->buf->start, cl->buf->pos, | 128 cl->buf->start, cl->buf->pos, |
129 cl->buf->last - cl->buf->pos, | 129 cl->buf->last - cl->buf->pos, |
130 cl->buf->file_pos, | 130 cl->buf->file_pos, |
131 cl->buf->file_last - cl->buf->file_pos); | 131 cl->buf->file_last - cl->buf->file_pos); |
132 | 132 |
133 #if 1 | 133 #if 1 |
134 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) { | 134 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) { |
135 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | 135 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
136 "zero size buf in writer " | 136 "zero size buf in writer " |
137 "t:%d r:%d f:%d %p %p-%p %p %O-%O", | 137 "t:%d r:%d f:%d %p %p-%p %p %O-%O", |
138 cl->buf->temporary, | 138 cl->buf->temporary, |
139 cl->buf->recycled, | 139 cl->buf->recycled, |
140 cl->buf->in_file, | 140 cl->buf->in_file, |
199 c->buffered &= ~NGX_HTTP_WRITE_BUFFERED; | 199 c->buffered &= ~NGX_HTTP_WRITE_BUFFERED; |
200 | 200 |
201 return NGX_OK; | 201 return NGX_OK; |
202 } | 202 } |
203 | 203 |
204 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | 204 ngx_log_error(NGX_LOG_ALERT, c->log, 0, |
205 "the http output chain is empty"); | 205 "the http output chain is empty"); |
206 | 206 |
207 ngx_debug_point(); | 207 ngx_debug_point(); |
208 | 208 |
209 return NGX_ERROR; | 209 return NGX_ERROR; |
212 if (r->limit_rate) { | 212 if (r->limit_rate) { |
213 to_send = r->limit_rate * (ngx_time() - r->start_time + 1) - c->sent; | 213 to_send = r->limit_rate * (ngx_time() - r->start_time + 1) - c->sent; |
214 | 214 |
215 if (to_send <= 0) { | 215 if (to_send <= 0) { |
216 c->write->delayed = 1; | 216 c->write->delayed = 1; |
217 ngx_add_timer(r->connection->write, | 217 ngx_add_timer(c->write, |
218 (ngx_msec_t) (- to_send * 1000 / r->limit_rate + 1)); | 218 (ngx_msec_t) (- to_send * 1000 / r->limit_rate + 1)); |
219 | 219 |
220 c->buffered |= NGX_HTTP_WRITE_BUFFERED; | 220 c->buffered |= NGX_HTTP_WRITE_BUFFERED; |
221 | 221 |
222 return NGX_AGAIN; | 222 return NGX_AGAIN; |
223 } | 223 } |
242 } | 242 } |
243 | 243 |
244 if (to_send) { | 244 if (to_send) { |
245 sent = c->sent - sent; | 245 sent = c->sent - sent; |
246 c->write->delayed = 1; | 246 c->write->delayed = 1; |
247 ngx_add_timer(r->connection->write, | 247 ngx_add_timer(c->write, (ngx_msec_t) (sent * 1000 / r->limit_rate + 1)); |
248 (ngx_msec_t) (sent * 1000 / r->limit_rate + 1)); | |
249 } | 248 } |
250 | 249 |
251 for (cl = r->out; cl && cl != chain; /* void */) { | 250 for (cl = r->out; cl && cl != chain; /* void */) { |
252 ln = cl; | 251 ln = cl; |
253 cl = cl->next; | 252 cl = cl->next; |