Mercurial > hg > nginx-vendor-0-7
comparison src/core/ngx_buf.c @ 48:6cfc63e68377 NGINX_0_1_24
nginx 0.1.24
*) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING
and DOCUMENT_URI variables.
*) Bugfix: the ngx_http_autoindex_module may some times return the 404
response for existent directory, if this directory was used in
"alias" directive.
*) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large
responses.
*) Bugfix: the lack of the "Referer" header line was always accounted
as valid referrer.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 04 Mar 2005 00:00:00 +0300 |
parents | 6f8b0dc0f8dd |
children | 72eb30262aac |
comparison
equal
deleted
inserted
replaced
47:4ae32548452c | 48:6cfc63e68377 |
---|---|
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 | 9 |
10 | 10 |
11 ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size) | 11 ngx_buf_t * |
12 ngx_create_temp_buf(ngx_pool_t *pool, size_t size) | |
12 { | 13 { |
13 ngx_buf_t *b; | 14 ngx_buf_t *b; |
14 | 15 |
15 if (!(b = ngx_calloc_buf(pool))) { | 16 if (!(b = ngx_calloc_buf(pool))) { |
16 return NULL; | 17 return NULL; |
18 | 19 |
19 if (!(b->start = ngx_palloc(pool, size))) { | 20 if (!(b->start = ngx_palloc(pool, size))) { |
20 return NULL; | 21 return NULL; |
21 } | 22 } |
22 | 23 |
24 /* | |
25 * set by ngx_calloc_buf(): | |
26 * | |
27 * b->file_pos = 0; | |
28 * b->file_last = 0; | |
29 * b->file = NULL; | |
30 * b->shadow = NULL; | |
31 * b->tag = 0; | |
32 * | |
33 */ | |
34 | |
23 b->pos = b->start; | 35 b->pos = b->start; |
24 b->last = b->start; | 36 b->last = b->start; |
25 b->end = b->last + size; | 37 b->end = b->last + size; |
26 b->temporary = 1; | 38 b->temporary = 1; |
27 | 39 |
28 /* | |
29 | |
30 b->file_pos = 0; | |
31 b->file_last = 0; | |
32 | |
33 b->file = NULL; | |
34 b->shadow = NULL; | |
35 | |
36 b->tag = 0; | |
37 | |
38 */ | |
39 | |
40 return b; | 40 return b; |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 ngx_chain_t *ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs) | 44 ngx_chain_t * |
45 ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs) | |
45 { | 46 { |
46 u_char *p; | 47 u_char *p; |
47 ngx_int_t i; | 48 ngx_int_t i; |
48 ngx_buf_t *b; | 49 ngx_buf_t *b; |
49 ngx_chain_t *chain, *cl, **ll; | 50 ngx_chain_t *chain, *cl, **ll; |
57 for (i = 0; i < bufs->num; i++) { | 58 for (i = 0; i < bufs->num; i++) { |
58 if (!(b = ngx_calloc_buf(pool))) { | 59 if (!(b = ngx_calloc_buf(pool))) { |
59 return NULL; | 60 return NULL; |
60 } | 61 } |
61 | 62 |
63 /* | |
64 * set by ngx_calloc_buf(): | |
65 * | |
66 * b->file_pos = 0; | |
67 * b->file_last = 0; | |
68 * b->file = NULL; | |
69 * b->shadow = NULL; | |
70 * b->tag = 0; | |
71 * | |
72 */ | |
73 | |
62 b->pos = p; | 74 b->pos = p; |
63 b->last = p; | 75 b->last = p; |
64 b->temporary = 1; | 76 b->temporary = 1; |
65 | 77 |
66 b->start = p; | 78 b->start = p; |
67 p += bufs->size; | 79 p += bufs->size; |
68 b->end = p; | 80 b->end = p; |
69 | |
70 /* | |
71 b->file_pos = 0; | |
72 b->file_last = 0; | |
73 | |
74 b->file = NULL; | |
75 b->shadow = NULL; | |
76 b->tag = 0; | |
77 */ | |
78 | 81 |
79 if (!(cl = ngx_alloc_chain_link(pool))) { | 82 if (!(cl = ngx_alloc_chain_link(pool))) { |
80 return NULL; | 83 return NULL; |
81 } | 84 } |
82 | 85 |
89 | 92 |
90 return chain; | 93 return chain; |
91 } | 94 } |
92 | 95 |
93 | 96 |
94 ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, | 97 ngx_int_t |
95 ngx_chain_t *in) | 98 ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in) |
96 { | 99 { |
97 ngx_chain_t *cl, **ll; | 100 ngx_chain_t *cl, **ll; |
98 | 101 |
99 ll = chain; | 102 ll = chain; |
100 | 103 |
115 | 118 |
116 return NGX_OK; | 119 return NGX_OK; |
117 } | 120 } |
118 | 121 |
119 | 122 |
120 void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, | 123 void |
121 ngx_chain_t **out, ngx_buf_tag_t tag) | 124 ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, |
125 ngx_chain_t **out, ngx_buf_tag_t tag) | |
122 { | 126 { |
123 ngx_chain_t *tl; | 127 ngx_chain_t *cl; |
124 | 128 |
125 if (*busy == NULL) { | 129 if (*busy == NULL) { |
126 *busy = *out; | 130 *busy = *out; |
127 | 131 |
128 } else { | 132 } else { |
129 for (tl = *busy; tl->next; tl = tl->next) { | 133 for (cl = *busy; cl->next; cl = cl->next) { /* void */ } |
130 /* void */; | |
131 } | |
132 | 134 |
133 tl->next = *out; | 135 cl->next = *out; |
134 } | 136 } |
135 | 137 |
136 *out = NULL; | 138 *out = NULL; |
137 | 139 |
138 while (*busy) { | 140 while (*busy) { |
152 } | 154 } |
153 | 155 |
154 (*busy)->buf->pos = (*busy)->buf->start; | 156 (*busy)->buf->pos = (*busy)->buf->start; |
155 (*busy)->buf->last = (*busy)->buf->start; | 157 (*busy)->buf->last = (*busy)->buf->start; |
156 | 158 |
157 tl = *busy; | 159 cl = *busy; |
158 *busy = (*busy)->next; | 160 *busy = cl->next; |
159 tl->next = *free; | 161 cl->next = *free; |
160 *free = tl; | 162 *free = cl; |
161 } | 163 } |
162 } | 164 } |