comparison src/imap/ngx_imap_parse.c @ 92:45945fa8b8ba NGINX_0_2_0

nginx 0.2.0 *) The pid-file names used during online upgrade was changed and now is not required a manual rename operation. The old master process adds the ".oldbin" suffix to its pid-file and executes a new binary file. The new master process creates usual pid-file without the ".newbin" suffix. If the master process exits, then old master process renames back its pid-file with the ".oldbin" suffix to the pid-file without suffix. *) Change: the "worker_connections" directive, new name of the "connections" directive; now the directive specifies maximum number of connections, but not maximum socket descriptor number. *) Feature: SSL supports the session cache inside one worker process. *) Feature: the "satisfy_any" directive. *) Change: the ngx_http_access_module and ngx_http_auth_basic_module do not run for subrequests. *) Feature: the "worker_rlimit_nofile" and "worker_rlimit_sigpending" directives. *) Bugfix: if all backend using in load-balancing failed after one error, then nginx did not try do connect to them during 60 seconds. *) Bugfix: in IMAP/POP3 command argument parsing. Thanks to Rob Mueller. *) Bugfix: errors while using SSL in IMAP/POP3 proxy. *) Bugfix: errors while using SSI and gzipping. *) Bugfix: the "Expires" and "Cache-Control" header lines were omitted from the 304 responses. Thanks to Alexandr Kukushkin.
author Igor Sysoev <http://sysoev.ru>
date Fri, 23 Sep 2005 00:00:00 +0400
parents 9db7e0b5b27f
children df17fbafec8f
comparison
equal deleted inserted replaced
91:c3eee83ea942 92:45945fa8b8ba
18 sw_start = 0, 18 sw_start = 0,
19 sw_spaces_before_command, 19 sw_spaces_before_command,
20 sw_command, 20 sw_command,
21 sw_spaces_before_argument, 21 sw_spaces_before_argument,
22 sw_argument, 22 sw_argument,
23 sw_backslash,
23 sw_literal, 24 sw_literal,
25 sw_no_sync_literal_argument,
24 sw_start_literal_argument, 26 sw_start_literal_argument,
25 sw_literal_argument, 27 sw_literal_argument,
26 sw_end_literal_argument, 28 sw_end_literal_argument,
27 sw_almost_done 29 sw_almost_done
28 } state; 30 } state;
223 break; 225 break;
224 case LF: 226 case LF:
225 goto done; 227 goto done;
226 } 228 }
227 break; 229 break;
230 case '\\':
231 if (s->quoted) {
232 s->backslash = 1;
233 state = sw_backslash;
234 }
235 break;
236 }
237 break;
238
239 case sw_backslash:
240 switch (ch) {
241 case CR:
242 case LF:
243 goto invalid;
244 default:
245 state = sw_argument;
228 } 246 }
229 break; 247 break;
230 248
231 case sw_literal: 249 case sw_literal:
232 if (ch >= '0' && ch <= '9') { 250 if (ch >= '0' && ch <= '9') {
235 } 253 }
236 if (ch == '}') { 254 if (ch == '}') {
237 state = sw_start_literal_argument; 255 state = sw_start_literal_argument;
238 break; 256 break;
239 } 257 }
258 if (ch == '+') {
259 state = sw_no_sync_literal_argument;
260 break;
261 }
262 goto invalid;
263
264 case sw_no_sync_literal_argument:
265 if (ch == '}') {
266 s->no_sync_literal = 1;
267 state = sw_start_literal_argument;
268 break;
269 }
240 goto invalid; 270 goto invalid;
241 271
242 case sw_start_literal_argument: 272 case sw_start_literal_argument:
243 switch (ch) { 273 switch (ch) {
244 case CR: 274 case CR:
245 break; 275 break;
246 case LF: 276 case LF:
247 s->buffer->pos = p + 1; 277 s->buffer->pos = p + 1;
248 s->arg_start = p + 1; 278 s->arg_start = p + 1;
249 s->state = sw_literal_argument; 279 if (s->no_sync_literal == 0) {
250 return NGX_IMAP_NEXT; 280 s->state = sw_literal_argument;
251 } 281 return NGX_IMAP_NEXT;
252 goto invalid; 282 }
283 state = sw_literal_argument;
284 s->no_sync_literal = 0;
285 break;
286 default:
287 goto invalid;
288 }
289 break;
253 290
254 case sw_literal_argument: 291 case sw_literal_argument:
255 if (s->literal_len && --s->literal_len) { 292 if (s->literal_len && --s->literal_len) {
256 break; 293 break;
257 } 294 }
310 if (arg == NULL) { 347 if (arg == NULL) {
311 return NGX_ERROR; 348 return NGX_ERROR;
312 } 349 }
313 arg->len = s->arg_end - s->arg_start; 350 arg->len = s->arg_end - s->arg_start;
314 arg->data = s->arg_start; 351 arg->data = s->arg_start;
352
315 s->arg_start = NULL; 353 s->arg_start = NULL;
316 s->cmd_start = NULL; 354 s->cmd_start = NULL;
317 s->quoted = 0; 355 s->quoted = 0;
356 s->no_sync_literal = 0;
318 s->literal_len = 0; 357 s->literal_len = 0;
319 } 358 }
320 359
321 s->state = sw_start; 360 s->state = sw_start;
322 361
324 363
325 invalid: 364 invalid:
326 365
327 s->state = sw_start; 366 s->state = sw_start;
328 s->quoted = 0; 367 s->quoted = 0;
368 s->no_sync_literal = 0;
329 s->literal_len = 0; 369 s->literal_len = 0;
330 370
331 return NGX_IMAP_PARSE_INVALID_COMMAND; 371 return NGX_IMAP_PARSE_INVALID_COMMAND;
332 } 372 }
333 373
430 } 470 }
431 break; 471 break;
432 472
433 case sw_argument: 473 case sw_argument:
434 switch (ch) { 474 switch (ch) {
435 case ' ': 475
476 /*
477 * the space should be considered part of the at username
478 * or password, but not of argument in other commands
479 *
480 * case ' ':
481 */
482
436 case CR: 483 case CR:
437 case LF: 484 case LF:
438 arg = ngx_array_push(&s->args); 485 arg = ngx_array_push(&s->args);
439 if (arg == NULL) { 486 if (arg == NULL) {
440 return NGX_ERROR; 487 return NGX_ERROR;