Mercurial > hg > nginx
comparison src/core/ngx_conf_file.c @ 158:d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 24 Oct 2003 06:53:41 +0000 |
parents | 70b36c805682 |
children | 389d7ee9fa60 |
comparison
equal
deleted
inserted
replaced
157:70b36c805682 | 158:d377ee423603 |
---|---|
594 | 594 |
595 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 595 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
596 { | 596 { |
597 char *p = conf; | 597 char *p = conf; |
598 | 598 |
599 int *np; | 599 int *np; |
600 ngx_str_t *value; | 600 ngx_str_t *value; |
601 ngx_conf_post_t *post; | |
601 | 602 |
602 | 603 |
603 np = (int *) (p + cmd->offset); | 604 np = (int *) (p + cmd->offset); |
604 | 605 |
605 if (*np != NGX_CONF_UNSET) { | 606 if (*np != NGX_CONF_UNSET) { |
610 *np = ngx_atoi(value[1].data, value[1].len); | 611 *np = ngx_atoi(value[1].data, value[1].len); |
611 if (*np == NGX_ERROR) { | 612 if (*np == NGX_ERROR) { |
612 return "invalid number"; | 613 return "invalid number"; |
613 } | 614 } |
614 | 615 |
615 if (cmd->bounds) { | 616 if (cmd->post) { |
616 return cmd->bounds->check(cf, cmd->bounds, np); | 617 post = cmd->post; |
618 return post->post_handler(cf, post, np); | |
617 } | 619 } |
618 | 620 |
619 return NGX_CONF_OK; | 621 return NGX_CONF_OK; |
620 } | 622 } |
621 | 623 |
622 | 624 |
623 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 625 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
624 { | 626 { |
625 char *p = conf; | 627 char *p = conf; |
626 | 628 |
627 int *np; | 629 int *np; |
628 ngx_str_t *value; | 630 ngx_str_t *value; |
631 ngx_conf_post_t *post; | |
629 | 632 |
630 | 633 |
631 np = (int *) (p + cmd->offset); | 634 np = (int *) (p + cmd->offset); |
632 if (*np != NGX_CONF_UNSET) { | 635 if (*np != NGX_CONF_UNSET) { |
633 return "is duplicate"; | 636 return "is duplicate"; |
638 *np = ngx_parse_size(&value[1]); | 641 *np = ngx_parse_size(&value[1]); |
639 if (*np == NGX_ERROR) { | 642 if (*np == NGX_ERROR) { |
640 return "invalid value"; | 643 return "invalid value"; |
641 } | 644 } |
642 | 645 |
643 if (cmd->bounds) { | 646 if (cmd->post) { |
644 return cmd->bounds->check(cf, cmd->bounds, np); | 647 post = cmd->post; |
648 return post->post_handler(cf, post, np); | |
645 } | 649 } |
646 | 650 |
647 return NGX_CONF_OK; | 651 return NGX_CONF_OK; |
648 } | 652 } |
649 | 653 |
650 | 654 |
651 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 655 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
652 { | 656 { |
653 char *p = conf; | 657 char *p = conf; |
654 | 658 |
655 int size, total, len, scale, *np; | 659 int *np; |
656 u_int max, i; | 660 ngx_str_t *value; |
657 char last, *start; | 661 ngx_conf_post_t *post; |
658 ngx_str_t *value; | |
659 | 662 |
660 | 663 |
661 np = (int *) (p + cmd->offset); | 664 np = (int *) (p + cmd->offset); |
662 if (*np != NGX_CONF_UNSET) { | 665 if (*np != NGX_CONF_UNSET) { |
663 return "is duplicate"; | 666 return "is duplicate"; |
672 | 675 |
673 if (*np == NGX_PARSE_LARGE_TIME) { | 676 if (*np == NGX_PARSE_LARGE_TIME) { |
674 return "value must be less than 597 hours"; | 677 return "value must be less than 597 hours"; |
675 } | 678 } |
676 | 679 |
677 if (cmd->bounds) { | 680 if (cmd->post) { |
678 return cmd->bounds->check(cf, cmd->bounds, np); | 681 post = cmd->post; |
682 return post->post_handler(cf, post, np); | |
679 } | 683 } |
680 | 684 |
681 return NGX_CONF_OK; | 685 return NGX_CONF_OK; |
682 } | 686 } |
683 | 687 |
684 | 688 |
685 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 689 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
686 { | 690 { |
687 char *p = conf; | 691 char *p = conf; |
688 | 692 |
689 int size, total, len, scale, *np; | 693 int *np; |
690 u_int max, i; | 694 ngx_str_t *value; |
691 char last, *start; | 695 ngx_conf_post_t *post; |
692 ngx_str_t *value; | |
693 | 696 |
694 | 697 |
695 np = (int *) (p + cmd->offset); | 698 np = (int *) (p + cmd->offset); |
696 if (*np != NGX_CONF_UNSET) { | 699 if (*np != NGX_CONF_UNSET) { |
697 return "is duplicate"; | 700 return "is duplicate"; |
706 | 709 |
707 if (*np == NGX_PARSE_LARGE_TIME) { | 710 if (*np == NGX_PARSE_LARGE_TIME) { |
708 return "value must be less than 68 years"; | 711 return "value must be less than 68 years"; |
709 } | 712 } |
710 | 713 |
711 if (cmd->bounds) { | 714 if (cmd->post) { |
712 return cmd->bounds->check(cf, cmd->bounds, np); | 715 post = cmd->post; |
716 return post->post_handler(cf, post, np); | |
713 } | 717 } |
714 | 718 |
715 return NGX_CONF_OK; | 719 return NGX_CONF_OK; |
716 } | 720 } |
717 | 721 |
749 { | 753 { |
750 return "unsupported on this platform"; | 754 return "unsupported on this platform"; |
751 } | 755 } |
752 | 756 |
753 | 757 |
754 char *ngx_conf_check_num_bounds(ngx_conf_t *cf, ngx_conf_bounds_t *bounds, | 758 char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data) |
755 void *conf) | 759 { |
756 { | 760 ngx_conf_num_bounds_t *bounds = post; |
757 int *num = conf; | 761 int *np = data; |
758 | 762 |
759 if (*num >= bounds->type.num.low && *num <= bounds->type.num.high) { | 763 if (*np >= bounds->low && (u_int) *np <= (u_int) bounds->high) { |
760 return NGX_CONF_OK; | 764 return NGX_CONF_OK; |
761 | |
762 } | 765 } |
763 | 766 |
764 return "invalid value"; | 767 return "invalid value"; |
765 } | 768 } |