Mercurial > hg > nginx-vendor-current
comparison src/imap/ngx_imap.c @ 76:da9a3b14312d NGINX_0_1_38
nginx 0.1.38
*) Feature: the "limit_rate" directive is supported in in proxy and
FastCGI mode.
*) Feature: the "X-Accel-Limit-Rate" response header line is supported
in proxy and FastCGI mode.
*) Feature: the "break" directive.
*) Feature: the "log_not_found" directive.
*) Bugfix: the response status code was not changed when request was
redirected by the ""X-Accel-Redirect" header line.
*) Bugfix: the variables set by the "set" directive could not be used
in SSI.
*) Bugfix: the segmentation fault may occurred if the SSI page has more
than one remote subrequest.
*) Bugfix: nginx treated the backend response as invalid if the status
line in the header was transferred in two packets; bug appeared in
0.1.29.
*) Feature: the "ssi_types" directive.
*) Feature: the "autoindex_exact_size" directive.
*) Bugfix: the ngx_http_autoindex_module did not support the long file
names in UTF-8.
*) Feature: the IMAP/POP3 proxy.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 08 Jul 2005 00:00:00 +0400 |
parents | |
children | 71c46860eb55 |
comparison
equal
deleted
inserted
replaced
75:985847bb65f9 | 76:da9a3b14312d |
---|---|
1 | |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 #include <ngx_event.h> | |
10 #include <ngx_imap.h> | |
11 | |
12 | |
13 static char *ngx_imap_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | |
14 | |
15 | |
16 ngx_uint_t ngx_imap_max_module; | |
17 | |
18 | |
19 static ngx_command_t ngx_imap_commands[] = { | |
20 | |
21 { ngx_string("imap"), | |
22 NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, | |
23 ngx_imap_block, | |
24 0, | |
25 0, | |
26 NULL }, | |
27 | |
28 ngx_null_command | |
29 }; | |
30 | |
31 | |
32 static ngx_core_module_t ngx_imap_module_ctx = { | |
33 ngx_string("imap"), | |
34 NULL, | |
35 NULL | |
36 }; | |
37 | |
38 | |
39 ngx_module_t ngx_imap_module = { | |
40 NGX_MODULE_V1, | |
41 &ngx_imap_module_ctx, /* module context */ | |
42 ngx_imap_commands, /* module directives */ | |
43 NGX_CORE_MODULE, /* module type */ | |
44 NULL, /* init module */ | |
45 NULL /* init process */ | |
46 }; | |
47 | |
48 | |
49 static char * | |
50 ngx_imap_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
51 { | |
52 char *rv; | |
53 ngx_uint_t m, mi, s; | |
54 ngx_conf_t pcf; | |
55 ngx_imap_module_t *module; | |
56 ngx_imap_conf_ctx_t *ctx; | |
57 ngx_imap_core_srv_conf_t **cscfp; | |
58 ngx_imap_core_main_conf_t *cmcf; | |
59 | |
60 /* the main imap context */ | |
61 | |
62 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_imap_conf_ctx_t)); | |
63 if (ctx == NULL) { | |
64 return NGX_CONF_ERROR; | |
65 } | |
66 | |
67 *(ngx_imap_conf_ctx_t **) conf = ctx; | |
68 | |
69 /* count the number of the http modules and set up their indices */ | |
70 | |
71 ngx_imap_max_module = 0; | |
72 for (m = 0; ngx_modules[m]; m++) { | |
73 if (ngx_modules[m]->type != NGX_IMAP_MODULE) { | |
74 continue; | |
75 } | |
76 | |
77 ngx_modules[m]->ctx_index = ngx_imap_max_module++; | |
78 } | |
79 | |
80 | |
81 /* the imap main_conf context, it is the same in the all imap contexts */ | |
82 | |
83 ctx->main_conf = ngx_pcalloc(cf->pool, | |
84 sizeof(void *) * ngx_imap_max_module); | |
85 if (ctx->main_conf == NULL) { | |
86 return NGX_CONF_ERROR; | |
87 } | |
88 | |
89 | |
90 /* | |
91 * the imap null srv_conf context, it is used to merge | |
92 * the server{}s' srv_conf's | |
93 */ | |
94 | |
95 ctx->srv_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_imap_max_module); | |
96 if (ctx->srv_conf == NULL) { | |
97 return NGX_CONF_ERROR; | |
98 } | |
99 | |
100 | |
101 /* | |
102 * create the main_conf's, the null srv_conf's, and the null loc_conf's | |
103 * of the all imap modules | |
104 */ | |
105 | |
106 for (m = 0; ngx_modules[m]; m++) { | |
107 if (ngx_modules[m]->type != NGX_IMAP_MODULE) { | |
108 continue; | |
109 } | |
110 | |
111 module = ngx_modules[m]->ctx; | |
112 mi = ngx_modules[m]->ctx_index; | |
113 | |
114 if (module->create_main_conf) { | |
115 ctx->main_conf[mi] = module->create_main_conf(cf); | |
116 if (ctx->main_conf[mi] == NULL) { | |
117 return NGX_CONF_ERROR; | |
118 } | |
119 } | |
120 | |
121 if (module->create_srv_conf) { | |
122 ctx->srv_conf[mi] = module->create_srv_conf(cf); | |
123 if (ctx->srv_conf[mi] == NULL) { | |
124 return NGX_CONF_ERROR; | |
125 } | |
126 } | |
127 } | |
128 | |
129 | |
130 /* parse inside the imap{} block */ | |
131 | |
132 pcf = *cf; | |
133 cf->ctx = ctx; | |
134 | |
135 cf->module_type = NGX_IMAP_MODULE; | |
136 cf->cmd_type = NGX_IMAP_MAIN_CONF; | |
137 rv = ngx_conf_parse(cf, NULL); | |
138 | |
139 if (rv != NGX_CONF_OK) { | |
140 *cf = pcf; | |
141 return rv; | |
142 } | |
143 | |
144 | |
145 /* init imap{} main_conf's, merge the server{}s' srv_conf's */ | |
146 | |
147 cmcf = ctx->main_conf[ngx_imap_core_module.ctx_index]; | |
148 cscfp = cmcf->servers.elts; | |
149 | |
150 for (m = 0; ngx_modules[m]; m++) { | |
151 if (ngx_modules[m]->type != NGX_IMAP_MODULE) { | |
152 continue; | |
153 } | |
154 | |
155 module = ngx_modules[m]->ctx; | |
156 mi = ngx_modules[m]->ctx_index; | |
157 | |
158 /* init imap{} main_conf's */ | |
159 | |
160 if (module->init_main_conf) { | |
161 rv = module->init_main_conf(cf, ctx->main_conf[mi]); | |
162 if (rv != NGX_CONF_OK) { | |
163 *cf = pcf; | |
164 return rv; | |
165 } | |
166 } | |
167 | |
168 for (s = 0; s < cmcf->servers.nelts; s++) { | |
169 | |
170 /* merge the server{}s' srv_conf's */ | |
171 | |
172 if (module->merge_srv_conf) { | |
173 rv = module->merge_srv_conf(cf, | |
174 ctx->srv_conf[mi], | |
175 cscfp[s]->ctx->srv_conf[mi]); | |
176 if (rv != NGX_CONF_OK) { | |
177 *cf = pcf; | |
178 return rv; | |
179 } | |
180 } | |
181 } | |
182 } | |
183 | |
184 /* imap{}'s cf->ctx was needed while the configuration merging */ | |
185 | |
186 *cf = pcf; | |
187 | |
188 return NGX_CONF_OK; | |
189 } |