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