Mercurial > hg > nginx-quic
annotate src/core/ngx_conf_file.c @ 4965:58dfef910ccd
Gzip: fixed zlib memLevel adjusting.
An incorrect memLevel (lower than 1) might be passed to deflateInit2() if the
"gzip_hash" directive is set to a value less than the value of "gzip_window"
directive. This resulted in "deflateInit2() failed: -2" alert and an empty
reply.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Fri, 14 Dec 2012 15:17:58 +0000 |
parents | 6e46016ea276 |
children | c821975c9068 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
6 |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
9 #include <ngx_core.h> |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
10 |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
11 #define NGX_CONF_BUFFER 4096 |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
12 |
501 | 13 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last); |
503 | 14 static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf); |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
15 static ngx_int_t ngx_conf_test_full_name(ngx_str_t *name); |
571 | 16 static void ngx_conf_flush_files(ngx_cycle_t *cycle); |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
17 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
18 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
19 static ngx_command_t ngx_conf_commands[] = { |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
20 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
21 { ngx_string("include"), |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
22 NGX_ANY_CONF|NGX_CONF_TAKE1, |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
23 ngx_conf_include, |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
24 0, |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
25 0, |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
26 NULL }, |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
27 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
28 ngx_null_command |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
29 }; |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
30 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
31 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
32 ngx_module_t ngx_conf_module = { |
509 | 33 NGX_MODULE_V1, |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
34 NULL, /* module context */ |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
35 ngx_conf_commands, /* module directives */ |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
36 NGX_CONF_MODULE, /* module type */ |
541 | 37 NULL, /* init master */ |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
38 NULL, /* init module */ |
541 | 39 NULL, /* init process */ |
40 NULL, /* init thread */ | |
41 NULL, /* exit thread */ | |
571 | 42 ngx_conf_flush_files, /* exit process */ |
541 | 43 NULL, /* exit master */ |
44 NGX_MODULE_V1_PADDING | |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
45 }; |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
46 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
47 |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
48 /* The eight fixed arguments */ |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
49 |
2214 | 50 static ngx_uint_t argument_number[] = { |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
51 NGX_CONF_NOARGS, |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
52 NGX_CONF_TAKE1, |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
53 NGX_CONF_TAKE2, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
54 NGX_CONF_TAKE3, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
55 NGX_CONF_TAKE4, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
56 NGX_CONF_TAKE5, |
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
57 NGX_CONF_TAKE6, |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
300
diff
changeset
|
58 NGX_CONF_TAKE7 |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
59 }; |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
60 |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
61 |
503 | 62 char * |
2073 | 63 ngx_conf_param(ngx_conf_t *cf) |
64 { | |
2772
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
65 char *rv; |
2073 | 66 ngx_str_t *param; |
67 ngx_buf_t b; | |
68 ngx_conf_file_t conf_file; | |
69 | |
70 param = &cf->cycle->conf_param; | |
71 | |
72 if (param->len == 0) { | |
73 return NGX_CONF_OK; | |
74 } | |
75 | |
76 ngx_memzero(&conf_file, sizeof(ngx_conf_file_t)); | |
77 | |
78 ngx_memzero(&b, sizeof(ngx_buf_t)); | |
79 | |
80 b.start = param->data; | |
81 b.pos = param->data; | |
82 b.last = param->data + param->len; | |
83 b.end = b.last; | |
84 b.temporary = 1; | |
85 | |
86 conf_file.file.fd = NGX_INVALID_FILE; | |
2772
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
87 conf_file.file.name.data = NULL; |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
88 conf_file.line = 0; |
2073 | 89 |
90 cf->conf_file = &conf_file; | |
91 cf->conf_file->buffer = &b; | |
92 | |
2772
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
93 rv = ngx_conf_parse(cf, NULL); |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
94 |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
95 cf->conf_file = NULL; |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
96 |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
97 return rv; |
2073 | 98 } |
99 | |
100 | |
101 char * | |
503 | 102 ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
103 { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
104 char *rv; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
105 ngx_fd_t fd; |
501 | 106 ngx_int_t rc; |
2339
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
107 ngx_buf_t buf; |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
108 ngx_conf_file_t *prev, conf_file; |
2073 | 109 enum { |
110 parse_file = 0, | |
111 parse_block, | |
112 parse_param | |
113 } type; | |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
114 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
115 #if (NGX_SUPPRESS_WARN) |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
116 fd = NGX_INVALID_FILE; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
117 prev = NULL; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
118 #endif |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
119 |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
120 if (filename) { |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
121 |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
122 /* open configuration file */ |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
123 |
1048
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
988
diff
changeset
|
124 fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
125 if (fd == NGX_INVALID_FILE) { |
581 | 126 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, |
593 | 127 ngx_open_file_n " \"%s\" failed", |
128 filename->data); | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
129 return NGX_CONF_ERROR; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
130 } |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
131 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
132 prev = cf->conf_file; |
501 | 133 |
2339
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
134 cf->conf_file = &conf_file; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
135 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
136 if (ngx_fd_info(fd, &cf->conf_file->file.info) == -1) { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
137 ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno, |
461 | 138 ngx_fd_info_n " \"%s\" failed", filename->data); |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
139 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
140 |
2339
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
141 cf->conf_file->buffer = &buf; |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
142 |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
143 buf.start = ngx_alloc(NGX_CONF_BUFFER, cf->log); |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
144 if (buf.start == NULL) { |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
145 goto failed; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
146 } |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
147 |
2339
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
148 buf.pos = buf.start; |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
149 buf.last = buf.start; |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
150 buf.end = buf.last + NGX_CONF_BUFFER; |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
151 buf.temporary = 1; |
629 | 152 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
153 cf->conf_file->file.fd = fd; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
154 cf->conf_file->file.name.len = filename->len; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
155 cf->conf_file->file.name.data = filename->data; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
156 cf->conf_file->file.offset = 0; |
1563
022ec9420f80
style fix: remove double semicolons
Igor Sysoev <igor@sysoev.ru>
parents:
1438
diff
changeset
|
157 cf->conf_file->file.log = cf->log; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
158 cf->conf_file->line = 1; |
543 | 159 |
2073 | 160 type = parse_file; |
161 | |
162 } else if (cf->conf_file->file.fd != NGX_INVALID_FILE) { | |
163 | |
164 type = parse_block; | |
543 | 165 |
166 } else { | |
2073 | 167 type = parse_param; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
168 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
169 |
543 | 170 |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
171 for ( ;; ) { |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
172 rc = ngx_conf_read_token(cf); |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
173 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
174 /* |
461 | 175 * ngx_conf_read_token() may return |
543 | 176 * |
461 | 177 * NGX_ERROR there is error |
178 * NGX_OK the token terminated by ";" was found | |
179 * NGX_CONF_BLOCK_START the token terminated by "{" was found | |
180 * NGX_CONF_BLOCK_DONE the "}" was found | |
181 * NGX_CONF_FILE_DONE the configuration file is done | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
182 */ |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
183 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
184 if (rc == NGX_ERROR) { |
1123
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
185 goto done; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
186 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
187 |
543 | 188 if (rc == NGX_CONF_BLOCK_DONE) { |
2064 | 189 |
2073 | 190 if (type != parse_block) { |
1122
3728476ab96d
stop on superfluous closing "}"
Igor Sysoev <igor@sysoev.ru>
parents:
1107
diff
changeset
|
191 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\""); |
1123
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
192 goto failed; |
1122
3728476ab96d
stop on superfluous closing "}"
Igor Sysoev <igor@sysoev.ru>
parents:
1107
diff
changeset
|
193 } |
3728476ab96d
stop on superfluous closing "}"
Igor Sysoev <igor@sysoev.ru>
parents:
1107
diff
changeset
|
194 |
2064 | 195 goto done; |
543 | 196 } |
197 | |
2064 | 198 if (rc == NGX_CONF_FILE_DONE) { |
199 | |
2073 | 200 if (type == parse_block) { |
2064 | 201 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
202 "unexpected end of file, expecting \"}\""); | |
203 goto failed; | |
204 } | |
205 | |
206 goto done; | |
543 | 207 } |
208 | |
2073 | 209 if (rc == NGX_CONF_BLOCK_START) { |
210 | |
211 if (type == parse_param) { | |
212 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
213 "block directives are not supported " | |
214 "in -g option"); | |
215 goto failed; | |
216 } | |
217 } | |
218 | |
2064 | 219 /* rc == NGX_OK || rc == NGX_CONF_BLOCK_START */ |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
220 |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
221 if (cf->handler) { |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
222 |
461 | 223 /* |
224 * the custom handler, i.e., that is used in the http's | |
225 * "types { ... }" directive | |
226 */ | |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
227 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
84
diff
changeset
|
228 rv = (*cf->handler)(cf, NULL, cf->handler_conf); |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
84
diff
changeset
|
229 if (rv == NGX_CONF_OK) { |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
84
diff
changeset
|
230 continue; |
501 | 231 } |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
84
diff
changeset
|
232 |
501 | 233 if (rv == NGX_CONF_ERROR) { |
1123
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
234 goto failed; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
235 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
236 |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
237 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, rv); |
1123
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
238 |
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
239 goto failed; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
240 } |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
241 |
501 | 242 |
243 rc = ngx_conf_handler(cf, rc); | |
244 | |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
245 if (rc == NGX_ERROR) { |
1123
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
246 goto failed; |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
247 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
248 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
249 |
1123
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
250 failed: |
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
251 |
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
252 rc = NGX_ERROR; |
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
253 |
88dc269bbca2
use "goto" instead of indistinct "break"
Igor Sysoev <igor@sysoev.ru>
parents:
1122
diff
changeset
|
254 done: |
501 | 255 |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
256 if (filename) { |
2339
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
257 if (cf->conf_file->buffer->start) { |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
258 ngx_free(cf->conf_file->buffer->start); |
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
259 } |
583 | 260 |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
261 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
262 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
263 ngx_close_file_n " %s failed", |
3296
f63865460aa6
cf->conf_file->file.name.data may be uninitialized, if an allocation failed;
Igor Sysoev <igor@sysoev.ru>
parents:
2906
diff
changeset
|
264 filename->data); |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
265 return NGX_CONF_ERROR; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
266 } |
2338 | 267 |
268 cf->conf_file = prev; | |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
269 } |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
270 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
271 if (rc == NGX_ERROR) { |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
272 return NGX_CONF_ERROR; |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
273 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
100
diff
changeset
|
274 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
275 return NGX_CONF_OK; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
276 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
277 |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
278 |
503 | 279 static ngx_int_t |
280 ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last) | |
501 | 281 { |
282 char *rv; | |
283 void *conf, **confp; | |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
284 ngx_uint_t i, found; |
501 | 285 ngx_str_t *name; |
286 ngx_command_t *cmd; | |
287 | |
288 name = cf->args->elts; | |
289 | |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
290 found = 0; |
645 | 291 |
501 | 292 for (i = 0; ngx_modules[i]; i++) { |
293 | |
294 cmd = ngx_modules[i]->commands; | |
295 if (cmd == NULL) { | |
296 continue; | |
297 } | |
298 | |
645 | 299 for ( /* void */ ; cmd->name.len; cmd++) { |
501 | 300 |
645 | 301 if (name->len != cmd->name.len) { |
302 continue; | |
303 } | |
501 | 304 |
645 | 305 if (ngx_strcmp(name->data, cmd->name.data) != 0) { |
306 continue; | |
307 } | |
308 | |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
309 found = 1; |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
310 |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
311 if (ngx_modules[i]->type != NGX_CONF_MODULE |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
312 && ngx_modules[i]->type != cf->module_type) |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
313 { |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
314 continue; |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
315 } |
645 | 316 |
317 /* is the directive's location right ? */ | |
318 | |
319 if (!(cmd->type & cf->cmd_type)) { | |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
320 continue; |
645 | 321 } |
322 | |
323 if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) { | |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
324 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
325 "directive \"%s\" is not terminated by \";\"", |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
326 name->data); |
645 | 327 return NGX_ERROR; |
328 } | |
501 | 329 |
645 | 330 if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) { |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
331 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
332 "directive \"%s\" has no opening \"{\"", |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
333 name->data); |
645 | 334 return NGX_ERROR; |
335 } | |
501 | 336 |
645 | 337 /* is the directive's argument count right ? */ |
501 | 338 |
645 | 339 if (!(cmd->type & NGX_CONF_ANY)) { |
501 | 340 |
645 | 341 if (cmd->type & NGX_CONF_FLAG) { |
501 | 342 |
645 | 343 if (cf->args->nelts != 2) { |
344 goto invalid; | |
501 | 345 } |
346 | |
347 } else if (cmd->type & NGX_CONF_1MORE) { | |
348 | |
645 | 349 if (cf->args->nelts < 2) { |
350 goto invalid; | |
501 | 351 } |
352 | |
353 } else if (cmd->type & NGX_CONF_2MORE) { | |
354 | |
645 | 355 if (cf->args->nelts < 3) { |
356 goto invalid; | |
501 | 357 } |
358 | |
645 | 359 } else if (cf->args->nelts > NGX_CONF_MAX_ARGS) { |
501 | 360 |
645 | 361 goto invalid; |
501 | 362 |
645 | 363 } else if (!(cmd->type & argument_number[cf->args->nelts - 1])) |
364 { | |
365 goto invalid; | |
501 | 366 } |
645 | 367 } |
501 | 368 |
645 | 369 /* set up the directive's configuration context */ |
501 | 370 |
645 | 371 conf = NULL; |
501 | 372 |
645 | 373 if (cmd->type & NGX_DIRECT_CONF) { |
374 conf = ((void **) cf->ctx)[ngx_modules[i]->index]; | |
501 | 375 |
645 | 376 } else if (cmd->type & NGX_MAIN_CONF) { |
377 conf = &(((void **) cf->ctx)[ngx_modules[i]->index]); | |
501 | 378 |
645 | 379 } else if (cf->ctx) { |
380 confp = *(void **) ((char *) cf->ctx + cmd->conf); | |
501 | 381 |
645 | 382 if (confp) { |
383 conf = confp[ngx_modules[i]->ctx_index]; | |
501 | 384 } |
645 | 385 } |
501 | 386 |
645 | 387 rv = cmd->set(cf, cmd, conf); |
501 | 388 |
645 | 389 if (rv == NGX_CONF_OK) { |
390 return NGX_OK; | |
391 } | |
392 | |
393 if (rv == NGX_CONF_ERROR) { | |
501 | 394 return NGX_ERROR; |
395 } | |
396 | |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
397 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1237 | 398 "\"%s\" directive %s", name->data, rv); |
645 | 399 |
400 return NGX_ERROR; | |
501 | 401 } |
402 } | |
403 | |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
404 if (found) { |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
405 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
406 "\"%s\" directive is not allowed here", name->data); |
645 | 407 |
408 return NGX_ERROR; | |
409 } | |
410 | |
4768
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
411 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1c5e2e4d5b35
Improved diagnostics when a directive is specified in the wrong context.
Ruslan Ermilov <ru@nginx.com>
parents:
4759
diff
changeset
|
412 "unknown directive \"%s\"", name->data); |
645 | 413 |
414 return NGX_ERROR; | |
415 | |
416 invalid: | |
417 | |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
418 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1438 | 419 "invalid number of arguments in \"%s\" directive", |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
420 name->data); |
501 | 421 |
422 return NGX_ERROR; | |
423 } | |
424 | |
425 | |
503 | 426 static ngx_int_t |
427 ngx_conf_read_token(ngx_conf_t *cf) | |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
428 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
429 u_char *start, ch, *src, *dst; |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
430 off_t file_size; |
2214 | 431 size_t len; |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
432 ssize_t n, size; |
2214 | 433 ngx_uint_t found, need_space, last_space, sharp_comment, variable; |
2216 | 434 ngx_uint_t quoted, s_quoted, d_quoted, start_line; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
435 ngx_str_t *word; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
436 ngx_buf_t *b; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
437 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
438 found = 0; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
439 need_space = 0; |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
440 last_space = 1; |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
441 sharp_comment = 0; |
509 | 442 variable = 0; |
2847 | 443 quoted = 0; |
444 s_quoted = 0; | |
445 d_quoted = 0; | |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
446 |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
447 cf->args->nelts = 0; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
448 b = cf->conf_file->buffer; |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
449 start = b->pos; |
2216 | 450 start_line = cf->conf_file->line; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
451 |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
452 file_size = ngx_file_size(&cf->conf_file->file.info); |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
453 |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
454 for ( ;; ) { |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
455 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
456 if (b->pos >= b->last) { |
2073 | 457 |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
458 if (cf->conf_file->file.offset >= file_size) { |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
459 |
4598
01a21ee8f8bb
Don't silently ignore the last line of configuration file that
Ruslan Ermilov <ru@nginx.com>
parents:
4593
diff
changeset
|
460 if (cf->args->nelts > 0 || !last_space) { |
2073 | 461 |
462 if (cf->conf_file->file.fd == NGX_INVALID_FILE) { | |
463 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
464 "unexpected end of parameter, " | |
465 "expecting \";\""); | |
466 return NGX_ERROR; | |
467 } | |
468 | |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
469 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
470 "unexpected end of file, " |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
471 "expecting \";\" or \"}\""); |
487 | 472 return NGX_ERROR; |
473 } | |
474 | |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
475 return NGX_CONF_FILE_DONE; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
476 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
477 |
2216 | 478 len = b->pos - start; |
479 | |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
480 if (len == NGX_CONF_BUFFER) { |
2216 | 481 cf->conf_file->line = start_line; |
482 | |
2217
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
483 if (d_quoted) { |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
484 ch = '"'; |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
485 |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
486 } else if (s_quoted) { |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
487 ch = '\''; |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
488 |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
489 } else { |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
490 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
491 "too long parameter \"%*s...\" started", |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
492 10, start); |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
493 return NGX_ERROR; |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
494 } |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
495 |
2216 | 496 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2217
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
497 "too long parameter, probably " |
31fda45f696f
quoted too long parameter error
Igor Sysoev <igor@sysoev.ru>
parents:
2216
diff
changeset
|
498 "missing terminating \"%c\" character", ch); |
2216 | 499 return NGX_ERROR; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
500 } |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
501 |
2216 | 502 if (len) { |
3887
e7798b5e990a
use memmove() in appropriate places
Igor Sysoev <igor@sysoev.ru>
parents:
3642
diff
changeset
|
503 ngx_memmove(b->start, start, len); |
2216 | 504 } |
505 | |
2226
7f3e1c63606b
fix building by msvc introduced in r2223
Igor Sysoev <igor@sysoev.ru>
parents:
2222
diff
changeset
|
506 size = (ssize_t) (file_size - cf->conf_file->file.offset); |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
507 |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
508 if (size > b->end - (b->start + len)) { |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
509 size = b->end - (b->start + len); |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
510 } |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
511 |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
512 n = ngx_read_file(&cf->conf_file->file, b->start + len, size, |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
513 cf->conf_file->file.offset); |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
514 |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
515 if (n == NGX_ERROR) { |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
516 return NGX_ERROR; |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
517 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
518 |
2222
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
519 if (n != size) { |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
520 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
521 ngx_read_file_n " returned " |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
522 "only %z bytes instead of %z", |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
523 n, size); |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
524 return NGX_ERROR; |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
525 } |
d200fbe9aa81
test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug
Igor Sysoev <igor@sysoev.ru>
parents:
2217
diff
changeset
|
526 |
2216 | 527 b->pos = b->start + len; |
528 b->last = b->pos + n; | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
529 start = b->start; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
530 } |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
531 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
532 ch = *b->pos++; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
533 |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
534 if (ch == LF) { |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
535 cf->conf_file->line++; |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
536 |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
537 if (sharp_comment) { |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
538 sharp_comment = 0; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
539 } |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
540 } |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
541 |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
542 if (sharp_comment) { |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
543 continue; |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
544 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
545 |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
546 if (quoted) { |
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
547 quoted = 0; |
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
548 continue; |
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
549 } |
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
550 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
551 if (need_space) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
552 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
553 last_space = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
554 need_space = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
555 continue; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
556 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
557 |
461 | 558 if (ch == ';') { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
559 return NGX_OK; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
560 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
561 |
461 | 562 if (ch == '{') { |
563 return NGX_CONF_BLOCK_START; | |
564 } | |
565 | |
581 | 566 if (ch == ')') { |
567 last_space = 1; | |
568 need_space = 0; | |
177
4db54fdbcbe7
nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
176
diff
changeset
|
569 |
581 | 570 } else { |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
571 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
572 "unexpected \"%c\"", ch); |
581 | 573 return NGX_ERROR; |
574 } | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
575 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
576 |
32
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
577 if (last_space) { |
d45effe5854c
nginx-0.0.1-2002-12-19-10:08:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
19
diff
changeset
|
578 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
579 continue; |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
580 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
581 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
582 start = b->pos - 1; |
2216 | 583 start_line = cf->conf_file->line; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
584 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
585 switch (ch) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
586 |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
587 case ';': |
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
588 case '{': |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
589 if (cf->args->nelts == 0) { |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
590 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
591 "unexpected \"%c\"", ch); |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
592 return NGX_ERROR; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
593 } |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
594 |
461 | 595 if (ch == '{') { |
596 return NGX_CONF_BLOCK_START; | |
597 } | |
598 | |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
599 return NGX_OK; |
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
600 |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
601 case '}': |
517 | 602 if (cf->args->nelts != 0) { |
1124
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
603 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
1123
diff
changeset
|
604 "unexpected \"}\""); |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
605 return NGX_ERROR; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
606 } |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
607 |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
608 return NGX_CONF_BLOCK_DONE; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
609 |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
610 case '#': |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
611 sharp_comment = 1; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
612 continue; |
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
613 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
614 case '\\': |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
615 quoted = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
616 last_space = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
617 continue; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
618 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
619 case '"': |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
620 start++; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
621 d_quoted = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
622 last_space = 0; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
623 continue; |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
624 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
625 case '\'': |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
626 start++; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
627 s_quoted = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
628 last_space = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
629 continue; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
630 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
631 default: |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
632 last_space = 0; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
633 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
634 |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
635 } else { |
509 | 636 if (ch == '{' && variable) { |
637 continue; | |
638 } | |
639 | |
640 variable = 0; | |
641 | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
642 if (ch == '\\') { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
643 quoted = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
644 continue; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
645 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
646 |
509 | 647 if (ch == '$') { |
648 variable = 1; | |
649 continue; | |
650 } | |
651 | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
652 if (d_quoted) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
653 if (ch == '"') { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
654 d_quoted = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
655 need_space = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
656 found = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
657 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
658 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
659 } else if (s_quoted) { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
660 if (ch == '\'') { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
661 s_quoted = 0; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
662 need_space = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
663 found = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
664 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
665 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
666 } else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF |
3642 | 667 || ch == ';' || ch == '{') |
668 { | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
669 last_space = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
670 found = 1; |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
671 } |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
672 |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
673 if (found) { |
501 | 674 word = ngx_array_push(cf->args); |
675 if (word == NULL) { | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
676 return NGX_ERROR; |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
677 } |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
678 |
2049 | 679 word->data = ngx_pnalloc(cf->pool, b->pos - start + 1); |
501 | 680 if (word->data == NULL) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
681 return NGX_ERROR; |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
682 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
683 |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
684 for (dst = word->data, src = start, len = 0; |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
685 src < b->pos - 1; |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
686 len++) |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
687 { |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
688 if (*src == '\\') { |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
689 switch (src[1]) { |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
690 case '"': |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
691 case '\'': |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
692 case '\\': |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
693 src++; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
694 break; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
695 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
696 case 't': |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
697 *dst++ = '\t'; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
698 src += 2; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
699 continue; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
700 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
701 case 'r': |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
702 *dst++ = '\r'; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
703 src += 2; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
704 continue; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
705 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
706 case 'n': |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
707 *dst++ = '\n'; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
708 src += 2; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
709 continue; |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
710 } |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
711 |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
712 } |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
713 *dst++ = *src++; |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
714 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
715 *dst = '\0'; |
37
9fe40e51d4a3
nginx-0.0.1-2002-12-23-21:22:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
36
diff
changeset
|
716 word->len = len; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
717 |
461 | 718 if (ch == ';') { |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
719 return NGX_OK; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
720 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
721 |
461 | 722 if (ch == '{') { |
723 return NGX_CONF_BLOCK_START; | |
724 } | |
725 | |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
726 found = 0; |
19
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
727 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
728 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
729 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
730 } |
d7908993fdeb
nginx-0.0.1-2002-12-02-19:09:40 import; resume after 2 months stall
Igor Sysoev <igor@sysoev.ru>
parents:
13
diff
changeset
|
731 |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
732 |
4827
6e46016ea276
Fixed the "include" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
4768
diff
changeset
|
733 char * |
503 | 734 ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
735 { |
727 | 736 char *rv; |
737 ngx_int_t n; | |
1911
ade85ba31674
included file name must be allocated in pool,
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
738 ngx_str_t *value, file, name; |
727 | 739 ngx_glob_t gl; |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
740 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
741 value = cf->args->elts; |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
742 file = value[1]; |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
743 |
727 | 744 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); |
745 | |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2339
diff
changeset
|
746 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
747 return NGX_CONF_ERROR; |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
748 } |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
749 |
1980 | 750 if (strpbrk((char *) file.data, "*?[") == NULL) { |
751 | |
752 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); | |
753 | |
754 return ngx_conf_parse(cf, &file); | |
755 } | |
756 | |
727 | 757 ngx_memzero(&gl, sizeof(ngx_glob_t)); |
758 | |
759 gl.pattern = file.data; | |
760 gl.log = cf->log; | |
1980 | 761 gl.test = 1; |
727 | 762 |
763 if (ngx_open_glob(&gl) != NGX_OK) { | |
764 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, | |
765 ngx_open_glob_n " \"%s\" failed", file.data); | |
766 return NGX_CONF_ERROR; | |
767 } | |
768 | |
769 rv = NGX_CONF_OK; | |
770 | |
771 for ( ;; ) { | |
1911
ade85ba31674
included file name must be allocated in pool,
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
772 n = ngx_read_glob(&gl, &name); |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
773 |
727 | 774 if (n != NGX_OK) { |
775 break; | |
776 } | |
777 | |
1911
ade85ba31674
included file name must be allocated in pool,
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
778 file.len = name.len++; |
ade85ba31674
included file name must be allocated in pool,
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
779 file.data = ngx_pstrdup(cf->pool, &name); |
ade85ba31674
included file name must be allocated in pool,
Igor Sysoev <igor@sysoev.ru>
parents:
1701
diff
changeset
|
780 |
727 | 781 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); |
782 | |
783 rv = ngx_conf_parse(cf, &file); | |
784 | |
785 if (rv != NGX_CONF_OK) { | |
786 break; | |
787 } | |
788 } | |
789 | |
790 ngx_close_glob(&gl); | |
791 | |
792 return rv; | |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
793 } |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
794 |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
795 |
503 | 796 ngx_int_t |
1352 | 797 ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix) |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
798 { |
1352 | 799 size_t len; |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
800 u_char *p, *n, *prefix; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
801 ngx_int_t rc; |
461 | 802 |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
803 rc = ngx_conf_test_full_name(name); |
461 | 804 |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
805 if (rc == NGX_OK) { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
806 return rc; |
2758 | 807 } |
808 | |
1352 | 809 if (conf_prefix) { |
2758 | 810 len = cycle->conf_prefix.len; |
811 prefix = cycle->conf_prefix.data; | |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
812 |
1352 | 813 } else { |
2758 | 814 len = cycle->prefix.len; |
815 prefix = cycle->prefix.data; | |
1352 | 816 } |
817 | |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
818 #if (NGX_WIN32) |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
819 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
820 if (rc == 2) { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
821 len = rc; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
822 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
823 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
824 #endif |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
825 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
826 n = ngx_pnalloc(cycle->pool, len + name->len + 1); |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
827 if (n == NULL) { |
2339
2142237f66da
allocate cf->conf_file and cf->conf_file->buffer on stack
Igor Sysoev <igor@sysoev.ru>
parents:
2338
diff
changeset
|
828 return NGX_ERROR; |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
829 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
830 |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
831 p = ngx_cpymem(n, prefix, len); |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
832 ngx_cpystrn(p, name->data, name->len + 1); |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
833 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
834 name->len += len; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
835 name->data = n; |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
836 |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
837 return NGX_OK; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
838 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
839 |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
840 |
2906
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
841 static ngx_int_t |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
842 ngx_conf_test_full_name(ngx_str_t *name) |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
843 { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
844 #if (NGX_WIN32) |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
845 u_char c0, c1; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
846 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
847 c0 = name->data[0]; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
848 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
849 if (name->len < 2) { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
850 if (c0 == '/') { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
851 return 2; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
852 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
853 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
854 return NGX_DECLINED; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
855 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
856 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
857 c1 = name->data[1]; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
858 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
859 if (c1 == ':') { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
860 c0 |= 0x20; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
861 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
862 if ((c0 >= 'a' && c0 <= 'z')) { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
863 return NGX_OK; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
864 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
865 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
866 return NGX_DECLINED; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
867 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
868 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
869 if (c1 == '/') { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
870 return NGX_OK; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
871 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
872 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
873 if (c0 == '/') { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
874 return 2; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
875 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
876 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
877 return NGX_DECLINED; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
878 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
879 #else |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
880 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
881 if (name->data[0] == '/') { |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
882 return NGX_OK; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
883 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
884 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
885 return NGX_DECLINED; |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
886 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
887 #endif |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
888 } |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
889 |
97693137d636
add drive letter for Win32 root path
Igor Sysoev <igor@sysoev.ru>
parents:
2847
diff
changeset
|
890 |
503 | 891 ngx_open_file_t * |
892 ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name) | |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
893 { |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
894 ngx_str_t full; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
895 ngx_uint_t i; |
414
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
896 ngx_list_part_t *part; |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
897 ngx_open_file_t *file; |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
898 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
447
diff
changeset
|
899 #if (NGX_SUPPRESS_WARN) |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3449
diff
changeset
|
900 ngx_str_null(&full); |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
447
diff
changeset
|
901 #endif |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
447
diff
changeset
|
902 |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2772
diff
changeset
|
903 if (name->len) { |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
904 full = *name; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
905 |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2339
diff
changeset
|
906 if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) { |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
907 return NULL; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
908 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
909 |
414
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
910 part = &cycle->open_files.part; |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
911 file = part->elts; |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
912 |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
913 for (i = 0; /* void */ ; i++) { |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
914 |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
915 if (i >= part->nelts) { |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
916 if (part->next == NULL) { |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
917 break; |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
918 } |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
919 part = part->next; |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
920 file = part->elts; |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
921 i = 0; |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
922 } |
388a842cbbe1
nginx-0.0.10-2004-09-03-19:50:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
412
diff
changeset
|
923 |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
924 if (full.len != file[i].name.len) { |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
925 continue; |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
926 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
927 |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
928 if (ngx_strcmp(full.data, file[i].name.data) == 0) { |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
929 return &file[i]; |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
930 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
931 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
932 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
933 |
501 | 934 file = ngx_list_push(&cycle->open_files); |
935 if (file == NULL) { | |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
936 return NULL; |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
937 } |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
938 |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2772
diff
changeset
|
939 if (name->len) { |
447
288f249897e7
nginx-0.1.0-2004-09-30-23:44:38 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
940 file->fd = NGX_INVALID_FILE; |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
941 file->name = full; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
435
diff
changeset
|
942 |
415
3c56e834be46
nginx-0.0.10-2004-09-05-23:54:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
414
diff
changeset
|
943 } else { |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2536
diff
changeset
|
944 file->fd = ngx_stderr; |
2785
d478379e51ac
*) refactor error_log processing: listen socket log might inherit built-in
Igor Sysoev <igor@sysoev.ru>
parents:
2772
diff
changeset
|
945 file->name = *name; |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
946 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
947 |
571 | 948 file->buffer = NULL; |
949 | |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
950 return file; |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
951 } |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
952 |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
953 |
571 | 954 static void |
955 ngx_conf_flush_files(ngx_cycle_t *cycle) | |
956 { | |
2302
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
957 ssize_t n, len; |
571 | 958 ngx_uint_t i; |
959 ngx_list_part_t *part; | |
960 ngx_open_file_t *file; | |
961 | |
962 ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files"); | |
963 | |
964 part = &cycle->open_files.part; | |
965 file = part->elts; | |
966 | |
967 for (i = 0; /* void */ ; i++) { | |
968 | |
969 if (i >= part->nelts) { | |
970 if (part->next == NULL) { | |
971 break; | |
972 } | |
973 part = part->next; | |
974 file = part->elts; | |
975 i = 0; | |
976 } | |
977 | |
2302
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
978 len = file[i].pos - file[i].buffer; |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
979 |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
980 if (file[i].buffer == NULL || len == 0) { |
571 | 981 continue; |
982 } | |
983 | |
2302
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
984 n = ngx_write_fd(file[i].fd, file[i].buffer, len); |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
985 |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
986 if (n == NGX_FILE_ERROR) { |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
987 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
988 ngx_write_fd_n " to \"%s\" failed", |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
989 file[i].name.data); |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
990 |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
991 } else if (n != len) { |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
992 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
993 ngx_write_fd_n " to \"%s\" was incomplete: %z of %uz", |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
994 file[i].name.data, n, len); |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2226
diff
changeset
|
995 } |
571 | 996 } |
997 } | |
998 | |
999 | |
503 | 1000 void ngx_cdecl |
1001 ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err, | |
3449
151ab752a782
const char *fmt in ngx_conf_log_error()
Igor Sysoev <igor@sysoev.ru>
parents:
3296
diff
changeset
|
1002 const char *fmt, ...) |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1003 { |
2336
81d506883bba
*) increase ngx_conf_log_error() buffer
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
1004 u_char errstr[NGX_MAX_CONF_ERRSTR], *p, *last; |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1005 va_list args; |
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1006 |
461 | 1007 last = errstr + NGX_MAX_CONF_ERRSTR; |
1008 | |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1009 va_start(args, fmt); |
2764
d4a717592877
use ngx_vslprintf(), ngx_slprintf()
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
1010 p = ngx_vslprintf(errstr, last, fmt, args); |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1011 va_end(args); |
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1012 |
2336
81d506883bba
*) increase ngx_conf_log_error() buffer
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
1013 if (err) { |
2765 | 1014 p = ngx_log_errno(p, last, err); |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1015 } |
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1016 |
593 | 1017 if (cf->conf_file == NULL) { |
2336
81d506883bba
*) increase ngx_conf_log_error() buffer
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
1018 ngx_log_error(level, cf->log, 0, "%*s", p - errstr, errstr); |
593 | 1019 return; |
1020 } | |
1021 | |
2772
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
1022 if (cf->conf_file->file.fd == NGX_INVALID_FILE) { |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
1023 ngx_log_error(level, cf->log, 0, "%*s in command line", |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
1024 p - errstr, errstr); |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
1025 return; |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
1026 } |
9b107cdf53f6
*) do not show line number for -g option
Igor Sysoev <igor@sysoev.ru>
parents:
2765
diff
changeset
|
1027 |
2336
81d506883bba
*) increase ngx_conf_log_error() buffer
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
1028 ngx_log_error(level, cf->log, 0, "%*s in %s:%ui", |
81d506883bba
*) increase ngx_conf_log_error() buffer
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
1029 p - errstr, errstr, |
81d506883bba
*) increase ngx_conf_log_error() buffer
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
1030 cf->conf_file->file.name.data, cf->conf_file->line); |
118
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1031 } |
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1032 |
5bf52498665c
nginx-0.0.1-2003-07-18-18:44:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
117
diff
changeset
|
1033 |
503 | 1034 char * |
1035 ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1036 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1037 char *p = conf; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1038 |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1039 ngx_str_t *value; |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1040 ngx_flag_t *fp; |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1041 ngx_conf_post_t *post; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1042 |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1043 fp = (ngx_flag_t *) (p + cmd->offset); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1044 |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1045 if (*fp != NGX_CONF_UNSET) { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1046 return "is duplicate"; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1047 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1048 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1049 value = cf->args->elts; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1050 |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1048
diff
changeset
|
1051 if (ngx_strcasecmp(value[1].data, (u_char *) "on") == 0) { |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1052 *fp = 1; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1053 |
1107
db7c468c447d
ngx_strcasecmp()/ngx_strncasecmp()
Igor Sysoev <igor@sysoev.ru>
parents:
1048
diff
changeset
|
1054 } else if (ngx_strcasecmp(value[1].data, (u_char *) "off") == 0) { |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1055 *fp = 0; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1056 |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1057 } else { |
119
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
1058 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
1059 "invalid value \"%s\" in \"%s\" directive, " |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
1060 "it must be \"on\" or \"off\"", |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
1061 value[1].data, cmd->name.data); |
cd54bcbaf3b5
nginx-0.0.1-2003-07-21-01:15:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
118
diff
changeset
|
1062 return NGX_CONF_ERROR; |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1063 } |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1064 |
435
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1065 if (cmd->post) { |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1066 post = cmd->post; |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1067 return post->post_handler(cf, post, fp); |
5cdc4838d4e8
nginx-0.0.11-2004-09-22-20:18:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1068 } |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1069 |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1070 return NGX_CONF_OK; |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1071 } |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1072 |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1073 |
503 | 1074 char * |
1075 ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1076 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1077 char *p = conf; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1078 |
412
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1079 ngx_str_t *field, *value; |
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1080 ngx_conf_post_t *post; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1081 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1082 field = (ngx_str_t *) (p + cmd->offset); |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1083 |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
1084 if (field->data) { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1085 return "is duplicate"; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1086 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1087 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1088 value = cf->args->elts; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1089 |
155
46eb23d9471d
nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents:
141
diff
changeset
|
1090 *field = value[1]; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1091 |
412
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1092 if (cmd->post) { |
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1093 post = cmd->post; |
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1094 return post->post_handler(cf, post, field); |
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1095 } |
199cd29f35a3
nginx-0.0.10-2004-08-31-19:32:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
1096 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1097 return NGX_CONF_OK; |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1098 } |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1099 |
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1100 |
503 | 1101 char * |
649 | 1102 ngx_conf_set_str_array_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
509 | 1103 { |
1104 char *p = conf; | |
1105 | |
649 | 1106 ngx_str_t *value, *s; |
509 | 1107 ngx_array_t **a; |
1108 ngx_conf_post_t *post; | |
1109 | |
1110 a = (ngx_array_t **) (p + cmd->offset); | |
1111 | |
1701
40d004d95d88
*) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
Igor Sysoev <igor@sysoev.ru>
parents:
1563
diff
changeset
|
1112 if (*a == NGX_CONF_UNSET_PTR) { |
649 | 1113 *a = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t)); |
509 | 1114 if (*a == NULL) { |
1115 return NGX_CONF_ERROR; | |
1116 } | |
1117 } | |
1118 | |
649 | 1119 s = ngx_array_push(*a); |
1120 if (s == NULL) { | |
509 | 1121 return NGX_CONF_ERROR; |
1122 } | |
1123 | |
1124 value = cf->args->elts; | |
1125 | |
649 | 1126 *s = value[1]; |
509 | 1127 |
1128 if (cmd->post) { | |
1129 post = cmd->post; | |
649 | 1130 return post->post_handler(cf, post, s); |
1131 } | |
1132 | |
1133 return NGX_CONF_OK; | |
1134 } | |
1135 | |
1136 | |
1137 char * | |
1138 ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1139 { | |
1140 char *p = conf; | |
1141 | |
1142 ngx_str_t *value; | |
1143 ngx_array_t **a; | |
1144 ngx_keyval_t *kv; | |
1145 ngx_conf_post_t *post; | |
1146 | |
1147 a = (ngx_array_t **) (p + cmd->offset); | |
1148 | |
1149 if (*a == NULL) { | |
1150 *a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t)); | |
1151 if (*a == NULL) { | |
1152 return NGX_CONF_ERROR; | |
1153 } | |
1154 } | |
1155 | |
1156 kv = ngx_array_push(*a); | |
1157 if (kv == NULL) { | |
1158 return NGX_CONF_ERROR; | |
1159 } | |
1160 | |
1161 value = cf->args->elts; | |
1162 | |
1163 kv->key = value[1]; | |
1164 kv->value = value[2]; | |
1165 | |
1166 if (cmd->post) { | |
1167 post = cmd->post; | |
1168 return post->post_handler(cf, post, kv); | |
509 | 1169 } |
1170 | |
1171 return NGX_CONF_OK; | |
1172 } | |
1173 | |
1174 | |
1175 char * | |
503 | 1176 ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1177 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1178 char *p = conf; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1179 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1180 ngx_int_t *np; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1181 ngx_str_t *value; |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1182 ngx_conf_post_t *post; |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1183 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1184 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1185 np = (ngx_int_t *) (p + cmd->offset); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1186 |
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1187 if (*np != NGX_CONF_UNSET) { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1188 return "is duplicate"; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1189 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1190 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1191 value = cf->args->elts; |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1192 *np = ngx_atoi(value[1].data, value[1].len); |
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1193 if (*np == NGX_ERROR) { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1194 return "invalid number"; |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1195 } |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1196 |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1197 if (cmd->post) { |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1198 post = cmd->post; |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1199 return post->post_handler(cf, post, np); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1200 } |
90
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1201 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1202 return NGX_CONF_OK; |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1203 } |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1204 |
37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
89
diff
changeset
|
1205 |
503 | 1206 char * |
1207 ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1208 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1209 char *p = conf; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1210 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1211 size_t *sp; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1212 ngx_str_t *value; |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1213 ngx_conf_post_t *post; |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1214 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1215 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1216 sp = (size_t *) (p + cmd->offset); |
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1217 if (*sp != NGX_CONF_UNSET_SIZE) { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1218 return "is duplicate"; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1219 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1220 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1221 value = cf->args->elts; |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1222 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1223 *sp = ngx_parse_size(&value[1]); |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1224 if (*sp == (size_t) NGX_ERROR) { |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1225 return "invalid value"; |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1226 } |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1227 |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1228 if (cmd->post) { |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1229 post = cmd->post; |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1230 return post->post_handler(cf, post, sp); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1231 } |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1232 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1233 return NGX_CONF_OK; |
10
4f3879d9b6f6
nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1234 } |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
10
diff
changeset
|
1235 |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1236 |
503 | 1237 char * |
663 | 1238 ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
1239 { | |
1240 char *p = conf; | |
1241 | |
1242 off_t *op; | |
1243 ngx_str_t *value; | |
1244 ngx_conf_post_t *post; | |
1245 | |
1246 | |
1247 op = (off_t *) (p + cmd->offset); | |
1248 if (*op != NGX_CONF_UNSET) { | |
1249 return "is duplicate"; | |
1250 } | |
1251 | |
1252 value = cf->args->elts; | |
1253 | |
1254 *op = ngx_parse_offset(&value[1]); | |
1255 if (*op == (off_t) NGX_ERROR) { | |
1256 return "invalid value"; | |
1257 } | |
1258 | |
1259 if (cmd->post) { | |
1260 post = cmd->post; | |
1261 return post->post_handler(cf, post, op); | |
1262 } | |
1263 | |
1264 return NGX_CONF_OK; | |
1265 } | |
1266 | |
1267 | |
1268 char * | |
503 | 1269 ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
10
diff
changeset
|
1270 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1271 char *p = conf; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1272 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1273 ngx_msec_t *msp; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1274 ngx_str_t *value; |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1275 ngx_conf_post_t *post; |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
10
diff
changeset
|
1276 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1277 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1278 msp = (ngx_msec_t *) (p + cmd->offset); |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1279 if (*msp != NGX_CONF_UNSET_MSEC) { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1280 return "is duplicate"; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1281 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1282 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1283 value = cf->args->elts; |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1284 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1285 *msp = ngx_parse_time(&value[1], 0); |
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1286 if (*msp == (ngx_msec_t) NGX_ERROR) { |
157
70b36c805682
nginx-0.0.1-2003-10-23-19:54:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
156
diff
changeset
|
1287 return "invalid value"; |
83
a7e45c45a95c
nginx-0.0.1-2003-04-28-19:06:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
1288 } |
a7e45c45a95c
nginx-0.0.1-2003-04-28-19:06:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
1289 |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1290 if (cmd->post) { |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1291 post = cmd->post; |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1292 return post->post_handler(cf, post, msp); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1293 } |
40
d5d4f3bba6f0
nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
37
diff
changeset
|
1294 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
43
diff
changeset
|
1295 return NGX_CONF_OK; |
13
2aba961a1d34
nginx-0.0.1-2002-09-16-19:01:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
10
diff
changeset
|
1296 } |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1297 |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1298 |
503 | 1299 char * |
1300 ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1301 { |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1302 char *p = conf; |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
1303 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1304 time_t *sp; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1305 ngx_str_t *value; |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1306 ngx_conf_post_t *post; |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1307 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1308 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1309 sp = (time_t *) (p + cmd->offset); |
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1310 if (*sp != NGX_CONF_UNSET) { |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1311 return "is duplicate"; |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1312 } |
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
91
diff
changeset
|
1313 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1314 value = cf->args->elts; |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1315 |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1316 *sp = ngx_parse_time(&value[1], 1); |
4474 | 1317 if (*sp == (time_t) NGX_ERROR) { |
157
70b36c805682
nginx-0.0.1-2003-10-23-19:54:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
156
diff
changeset
|
1318 return "invalid value"; |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1319 } |
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1320 |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1321 if (cmd->post) { |
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
157
diff
changeset
|
1322 post = cmd->post; |
265
6468241715e6
nginx-0.0.2-2004-02-20-19:48:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
1323 return post->post_handler(cf, post, sp); |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1324 } |
84
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1325 |
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1326 return NGX_CONF_OK; |
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1327 } |
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1328 |
fab4cb00fe5b
nginx-0.0.1-2003-05-06-21:03:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
83
diff
changeset
|
1329 |
503 | 1330 char * |
1331 ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
141
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1332 { |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1333 char *p = conf; |
141
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1334 |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1335 ngx_str_t *value; |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1336 ngx_bufs_t *bufs; |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1337 |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1338 |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1339 bufs = (ngx_bufs_t *) (p + cmd->offset); |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1340 if (bufs->num) { |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1341 return "is duplicate"; |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1342 } |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1343 |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1344 value = cf->args->elts; |
141
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1345 |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1346 bufs->num = ngx_atoi(value[1].data, value[1].len); |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1347 if (bufs->num == NGX_ERROR || bufs->num == 0) { |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1348 return "invalid value"; |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1349 } |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1350 |
157
70b36c805682
nginx-0.0.1-2003-10-23-19:54:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
156
diff
changeset
|
1351 bufs->size = ngx_parse_size(&value[2]); |
167
8aef3c72e5da
nginx-0.0.1-2003-10-30-19:51:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
166
diff
changeset
|
1352 if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) { |
141
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1353 return "invalid value"; |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1354 } |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1355 |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1356 return NGX_CONF_OK; |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1357 } |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1358 |
656d468f4ead
nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
119
diff
changeset
|
1359 |
503 | 1360 char * |
1361 ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1362 { |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1363 char *p = conf; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1364 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1365 ngx_uint_t *np, i; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1366 ngx_str_t *value; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1367 ngx_conf_enum_t *e; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1368 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1369 np = (ngx_uint_t *) (p + cmd->offset); |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1370 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1371 if (*np != NGX_CONF_UNSET_UINT) { |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1372 return "is duplicate"; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1373 } |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1374 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1375 value = cf->args->elts; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1376 e = cmd->post; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1377 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1378 for (i = 0; e[i].name.len != 0; i++) { |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1379 if (e[i].name.len != value[1].len |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1380 || ngx_strcasecmp(e[i].name.data, value[1].data) != 0) |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1381 { |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1382 continue; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1383 } |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1384 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1385 *np = e[i].value; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1386 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1387 return NGX_CONF_OK; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1388 } |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1389 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1390 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1391 "invalid value \"%s\"", value[1].data); |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1392 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1393 return NGX_CONF_ERROR; |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1394 } |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1395 |
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1396 |
503 | 1397 char * |
1398 ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1399 { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1400 char *p = conf; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1401 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1402 ngx_uint_t *np, i, m; |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1403 ngx_str_t *value; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1404 ngx_conf_bitmask_t *mask; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1405 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1406 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
265
diff
changeset
|
1407 np = (ngx_uint_t *) (p + cmd->offset); |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1408 value = cf->args->elts; |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1409 mask = cmd->post; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1410 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1411 for (i = 1; i < cf->args->nelts; i++) { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1412 for (m = 0; mask[m].name.len != 0; m++) { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1413 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1414 if (mask[m].name.len != value[i].len |
314
d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
1415 || ngx_strcasecmp(mask[m].name.data, value[i].data) != 0) |
166
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1416 { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1417 continue; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1418 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1419 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1420 if (*np & mask[m].mask) { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1421 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1422 "duplicate value \"%s\"", value[i].data); |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1423 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1424 } else { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1425 *np |= mask[m].mask; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1426 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1427 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1428 break; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1429 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1430 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1431 if (mask[m].name.len == 0) { |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1432 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1433 "invalid value \"%s\"", value[i].data); |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1434 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1435 return NGX_CONF_ERROR; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1436 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1437 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1438 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1439 return NGX_CONF_OK; |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1440 } |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1441 |
389d7ee9fa60
nginx-0.0.1-2003-10-30-11:51:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
1442 |
4759
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4598
diff
changeset
|
1443 #if 0 |
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4598
diff
changeset
|
1444 |
503 | 1445 char * |
1446 ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
64
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1447 { |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1448 return "unsupported on this platform"; |
34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
1449 } |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1450 |
4759
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4598
diff
changeset
|
1451 #endif |
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4598
diff
changeset
|
1452 |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1453 |
503 | 1454 char * |
581 | 1455 ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data) |
1456 { | |
1457 ngx_conf_deprecated_t *d = post; | |
1458 | |
1459 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1460 "the \"%s\" directive is deprecated, " | |
1461 "use the \"%s\" directive instead", | |
1462 d->old_name, d->new_name); | |
1463 | |
1464 return NGX_CONF_OK; | |
1465 } | |
1466 | |
1467 | |
1468 char * | |
503 | 1469 ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data) |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1470 { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
1471 ngx_conf_num_bounds_t *bounds = post; |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
1472 ngx_int_t *np = data; |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1473 |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1474 if (bounds->high == -1) { |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1475 if (*np >= bounds->low) { |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1476 return NGX_CONF_OK; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1477 } |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1478 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1479 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4474
diff
changeset
|
1480 "value must be equal to or greater than %i", |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4474
diff
changeset
|
1481 bounds->low); |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1482 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1483 return NGX_CONF_ERROR; |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1484 } |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1485 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1486 if (*np >= bounds->low && *np <= bounds->high) { |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1487 return NGX_CONF_OK; |
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1488 } |
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1489 |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1490 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
507 | 1491 "value must be between %i and %i", |
172
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1492 bounds->low, bounds->high); |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1493 |
caa57ddf6d77
nginx-0.0.1-2003-11-04-01:20:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
167
diff
changeset
|
1494 return NGX_CONF_ERROR; |
156
afc333135a6b
nginx-0.0.1-2003-10-23-10:13:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
1495 } |