comparison src/core/ngx_conf_file.c @ 52:0d75d65c642f NGINX_0_1_26

nginx 0.1.26 *) Change: the invalid client header lines are now ignored and logged at the info level. *) Change: the server name is also logged in error log. *) Feature: the ngx_http_auth_basic_module module and the auth_basic and auth_basic_user_file directives.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Mar 2005 00:00:00 +0300
parents 72eb30262aac
children 3050baa54a26
comparison
equal deleted inserted replaced
51:43f383e47efc 52:0d75d65c642f
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 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last); 11 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
12 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
12 static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 13 static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
13 14
14 15
15 static ngx_command_t ngx_conf_commands[] = { 16 static ngx_command_t ngx_conf_commands[] = {
16 17
31 ngx_conf_commands, /* module directives */ 32 ngx_conf_commands, /* module directives */
32 NGX_CONF_MODULE, /* module type */ 33 NGX_CONF_MODULE, /* module type */
33 NULL, /* init module */ 34 NULL, /* init module */
34 NULL /* init process */ 35 NULL /* init process */
35 }; 36 };
36
37 37
38 38
39 /* The ten fixed arguments */ 39 /* The ten fixed arguments */
40 40
41 static int argument_number[] = { 41 static int argument_number[] = {
47 NGX_CONF_TAKE5, 47 NGX_CONF_TAKE5,
48 NGX_CONF_TAKE6, 48 NGX_CONF_TAKE6,
49 NGX_CONF_TAKE7 49 NGX_CONF_TAKE7
50 }; 50 };
51 51
52 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf); 52
53 53 char *
54 54 ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
55 char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
56 { 55 {
57 char *rv; 56 char *rv;
58 ngx_fd_t fd; 57 ngx_fd_t fd;
59 ngx_int_t rc; 58 ngx_int_t rc;
60 ngx_conf_file_t *prev; 59 ngx_conf_file_t *prev;
171 170
172 return NGX_CONF_OK; 171 return NGX_CONF_OK;
173 } 172 }
174 173
175 174
176 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last) 175 static ngx_int_t
176 ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
177 { 177 {
178 char *rv; 178 char *rv;
179 void *conf, **confp; 179 void *conf, **confp;
180 ngx_uint_t i, valid; 180 ngx_uint_t i, valid;
181 ngx_str_t *name; 181 ngx_str_t *name;
329 329
330 return NGX_ERROR; 330 return NGX_ERROR;
331 } 331 }
332 332
333 333
334 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf) 334 static ngx_int_t
335 ngx_conf_read_token(ngx_conf_t *cf)
335 { 336 {
336 u_char *start, ch, *src, *dst; 337 u_char *start, ch, *src, *dst;
337 int len; 338 int len;
338 int found, need_space, last_space, sharp_comment; 339 int found, need_space, last_space, sharp_comment;
339 int quoted, s_quoted, d_quoted; 340 int quoted, s_quoted, d_quoted;
574 } 575 }
575 } 576 }
576 } 577 }
577 578
578 579
579 static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 580 static char *
581 ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
580 { 582 {
581 ngx_str_t *value, file; 583 ngx_str_t *value, file;
582 584
583 value = cf->args->elts; 585 value = cf->args->elts;
584 file = value[1]; 586 file = value[1];
591 593
592 return ngx_conf_parse(cf, &file); 594 return ngx_conf_parse(cf, &file);
593 } 595 }
594 596
595 597
596 ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name) 598 ngx_int_t
599 ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name)
597 { 600 {
598 u_char *p; 601 u_char *p;
599 ngx_str_t old; 602 ngx_str_t old;
600 603
601 if (name->data[0] == '/') { 604 if (name->data[0] == '/') {
639 642
640 return NGX_OK; 643 return NGX_OK;
641 } 644 }
642 645
643 646
644 ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name) 647 ngx_open_file_t *
648 ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
645 { 649 {
646 ngx_str_t full; 650 ngx_str_t full;
647 ngx_uint_t i; 651 ngx_uint_t i;
648 ngx_list_part_t *part; 652 ngx_list_part_t *part;
649 ngx_open_file_t *file; 653 ngx_open_file_t *file;
701 705
702 return file; 706 return file;
703 } 707 }
704 708
705 709
706 void ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err, 710 void ngx_cdecl
707 char *fmt, ...) 711 ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
712 char *fmt, ...)
708 { 713 {
709 u_char errstr[NGX_MAX_CONF_ERRSTR], *buf, *last; 714 u_char errstr[NGX_MAX_CONF_ERRSTR], *buf, *last;
710 va_list args; 715 va_list args;
711 716
712 last = errstr + NGX_MAX_CONF_ERRSTR; 717 last = errstr + NGX_MAX_CONF_ERRSTR;
727 ngx_log_error(level, cf->log, 0, "%s in %s:%d", 732 ngx_log_error(level, cf->log, 0, "%s in %s:%d",
728 errstr, cf->conf_file->file.name.data, cf->conf_file->line); 733 errstr, cf->conf_file->file.name.data, cf->conf_file->line);
729 } 734 }
730 735
731 736
732 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 737 char *
738 ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
733 { 739 {
734 char *p = conf; 740 char *p = conf;
735 741
736 ngx_str_t *value; 742 ngx_str_t *value;
737 ngx_flag_t *fp; 743 ngx_flag_t *fp;
766 772
767 return NGX_CONF_OK; 773 return NGX_CONF_OK;
768 } 774 }
769 775
770 776
771 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 777 char *
778 ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
772 { 779 {
773 char *p = conf; 780 char *p = conf;
774 781
775 ngx_str_t *field, *value; 782 ngx_str_t *field, *value;
776 ngx_conf_post_t *post; 783 ngx_conf_post_t *post;
792 799
793 return NGX_CONF_OK; 800 return NGX_CONF_OK;
794 } 801 }
795 802
796 803
797 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 804 char *
805 ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
798 { 806 {
799 char *p = conf; 807 char *p = conf;
800 808
801 ngx_int_t *np; 809 ngx_int_t *np;
802 ngx_str_t *value; 810 ngx_str_t *value;
822 830
823 return NGX_CONF_OK; 831 return NGX_CONF_OK;
824 } 832 }
825 833
826 834
827 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 835 char *
836 ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
828 { 837 {
829 char *p = conf; 838 char *p = conf;
830 839
831 size_t *sp; 840 size_t *sp;
832 ngx_str_t *value; 841 ngx_str_t *value;
852 861
853 return NGX_CONF_OK; 862 return NGX_CONF_OK;
854 } 863 }
855 864
856 865
857 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 866 char *
867 ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
858 { 868 {
859 char *p = conf; 869 char *p = conf;
860 870
861 ngx_msec_t *msp; 871 ngx_msec_t *msp;
862 ngx_str_t *value; 872 ngx_str_t *value;
886 896
887 return NGX_CONF_OK; 897 return NGX_CONF_OK;
888 } 898 }
889 899
890 900
891 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 901 char *
902 ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
892 { 903 {
893 char *p = conf; 904 char *p = conf;
894 905
895 time_t *sp; 906 time_t *sp;
896 ngx_str_t *value; 907 ngx_str_t *value;
920 931
921 return NGX_CONF_OK; 932 return NGX_CONF_OK;
922 } 933 }
923 934
924 935
925 char *ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 936 char *
937 ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
926 { 938 {
927 char *p = conf; 939 char *p = conf;
928 940
929 ngx_str_t *value; 941 ngx_str_t *value;
930 ngx_bufs_t *bufs; 942 ngx_bufs_t *bufs;
949 961
950 return NGX_CONF_OK; 962 return NGX_CONF_OK;
951 } 963 }
952 964
953 965
954 char *ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 966 char *
967 ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
955 { 968 {
956 char *p = conf; 969 char *p = conf;
957 970
958 ngx_uint_t *np, i; 971 ngx_uint_t *np, i;
959 ngx_str_t *value; 972 ngx_str_t *value;
985 998
986 return NGX_CONF_ERROR; 999 return NGX_CONF_ERROR;
987 } 1000 }
988 1001
989 1002
990 char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1003 char *
1004 ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
991 { 1005 {
992 char *p = conf; 1006 char *p = conf;
993 1007
994 ngx_uint_t *np, i, m; 1008 ngx_uint_t *np, i, m;
995 ngx_str_t *value; 1009 ngx_str_t *value;
1030 1044
1031 return NGX_CONF_OK; 1045 return NGX_CONF_OK;
1032 } 1046 }
1033 1047
1034 1048
1035 char *ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1049 char *
1050 ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1036 { 1051 {
1037 return "unsupported on this platform"; 1052 return "unsupported on this platform";
1038 } 1053 }
1039 1054
1040 1055
1041 char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data) 1056 char *
1057 ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data)
1042 { 1058 {
1043 ngx_conf_num_bounds_t *bounds = post; 1059 ngx_conf_num_bounds_t *bounds = post;
1044 ngx_int_t *np = data; 1060 ngx_int_t *np = data;
1045 1061
1046 if (bounds->high == -1) { 1062 if (bounds->high == -1) {