comparison src/mail/ngx_mail_core_module.c @ 654:753f505670e0 NGINX_1_1_11

nginx 1.1.11 *) Feature: the "so_keepalive" parameter of the "listen" directive. Thanks to Vsevolod Stakhov. *) Feature: the "if_not_empty" parameter of the "fastcgi/scgi/uwsgi_param" directives. *) Feature: the $https variable. *) Feature: the "proxy_redirect" directive supports variables in the first parameter. *) Feature: the "proxy_redirect" directive supports regular expressions. *) Bugfix: the $sent_http_cache_control variable might contain a wrong value if the "expires" directive was used. Thanks to Yichun Zhang. *) Bugfix: the "read_ahead" directive might not work combined with "try_files" and "open_file_cache". *) Bugfix: a segmentation fault might occur in a worker process if small time was used in the "inactive" parameter of the "proxy_cache_path" directive. *) Bugfix: responses from cache might hang.
author Igor Sysoev <http://sysoev.ru>
date Mon, 12 Dec 2011 00:00:00 +0400
parents 615b5ea36fc0
children d0f7a625f27c
comparison
equal deleted inserted replaced
653:8c96af2112c1 654:753f505670e0
22 void *conf); 22 void *conf);
23 static char *ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, 23 static char *ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd,
24 void *conf); 24 void *conf);
25 25
26 26
27 static ngx_conf_deprecated_t ngx_conf_deprecated_so_keepalive = {
28 ngx_conf_deprecated, "so_keepalive",
29 "so_keepalive\" parameter of the \"listen"
30 };
31
32
27 static ngx_command_t ngx_mail_core_commands[] = { 33 static ngx_command_t ngx_mail_core_commands[] = {
28 34
29 { ngx_string("server"), 35 { ngx_string("server"),
30 NGX_MAIL_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, 36 NGX_MAIL_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
31 ngx_mail_core_server, 37 ngx_mail_core_server,
50 { ngx_string("so_keepalive"), 56 { ngx_string("so_keepalive"),
51 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_FLAG, 57 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_FLAG,
52 ngx_conf_set_flag_slot, 58 ngx_conf_set_flag_slot,
53 NGX_MAIL_SRV_CONF_OFFSET, 59 NGX_MAIL_SRV_CONF_OFFSET,
54 offsetof(ngx_mail_core_srv_conf_t, so_keepalive), 60 offsetof(ngx_mail_core_srv_conf_t, so_keepalive),
55 NULL }, 61 &ngx_conf_deprecated_so_keepalive },
56 62
57 { ngx_string("timeout"), 63 { ngx_string("timeout"),
58 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, 64 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1,
59 ngx_conf_set_msec_slot, 65 ngx_conf_set_msec_slot,
60 NGX_MAIL_SRV_CONF_OFFSET, 66 NGX_MAIL_SRV_CONF_OFFSET,
444 "ngx_mail_ssl_module"); 450 "ngx_mail_ssl_module");
445 return NGX_CONF_ERROR; 451 return NGX_CONF_ERROR;
446 #endif 452 #endif
447 } 453 }
448 454
455 if (ngx_strncmp(value[i].data, "so_keepalive=", 13) == 0) {
456
457 if (ngx_strcmp(&value[i].data[13], "on") == 0) {
458 ls->so_keepalive = 1;
459
460 } else if (ngx_strcmp(&value[i].data[13], "off") == 0) {
461 ls->so_keepalive = 2;
462
463 } else {
464
465 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
466 u_char *p, *end;
467 ngx_str_t s;
468
469 end = value[i].data + value[i].len;
470 s.data = value[i].data + 13;
471
472 p = ngx_strlchr(s.data, end, ':');
473 if (p == NULL) {
474 p = end;
475 }
476
477 if (p > s.data) {
478 s.len = p - s.data;
479
480 ls->tcp_keepidle = ngx_parse_time(&s, 1);
481 if (ls->tcp_keepidle == NGX_ERROR) {
482 goto invalid_so_keepalive;
483 }
484 }
485
486 s.data = (p < end) ? (p + 1) : end;
487
488 p = ngx_strlchr(s.data, end, ':');
489 if (p == NULL) {
490 p = end;
491 }
492
493 if (p > s.data) {
494 s.len = p - s.data;
495
496 ls->tcp_keepintvl = ngx_parse_time(&s, 1);
497 if (ls->tcp_keepintvl == NGX_ERROR) {
498 goto invalid_so_keepalive;
499 }
500 }
501
502 s.data = (p < end) ? (p + 1) : end;
503
504 if (s.data < end) {
505 s.len = end - s.data;
506
507 ls->tcp_keepcnt = ngx_atoi(s.data, s.len);
508 if (ls->tcp_keepcnt == NGX_ERROR) {
509 goto invalid_so_keepalive;
510 }
511 }
512
513 if (ls->tcp_keepidle == 0 && ls->tcp_keepintvl == 0
514 && ls->tcp_keepcnt == 0)
515 {
516 goto invalid_so_keepalive;
517 }
518
519 ls->so_keepalive = 1;
520
521 #else
522
523 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
524 "the \"so_keepalive\" parameter accepts "
525 "only \"on\" or \"off\" on this platform");
526 return NGX_CONF_ERROR;
527
528 #endif
529 }
530
531 ls->bind = 1;
532
533 continue;
534
535 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
536 invalid_so_keepalive:
537
538 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
539 "invalid so_keepalive value: \"%s\"",
540 &value[i].data[13]);
541 return NGX_CONF_ERROR;
542 #endif
543 }
544
449 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 545 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
450 "the invalid \"%V\" parameter", &value[i]); 546 "the invalid \"%V\" parameter", &value[i]);
451 return NGX_CONF_ERROR; 547 return NGX_CONF_ERROR;
452 } 548 }
453 549