Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 89:29bf798b583f
nginx-0.0.1-2003-05-15-19:42:53 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 15 May 2003 15:42:53 +0000 |
parents | 674d333f4296 |
children | 37530da31268 |
comparison
equal
deleted
inserted
replaced
88:674d333f4296 | 89:29bf798b583f |
---|---|
38 | 38 |
39 {ngx_string("server"), | 39 {ngx_string("server"), |
40 NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, | 40 NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
41 ngx_server_block, | 41 ngx_server_block, |
42 0, | 42 0, |
43 0}, | 43 0, |
44 NULL,}, | |
44 | 45 |
45 {ngx_string("post_accept_timeout"), | 46 {ngx_string("post_accept_timeout"), |
46 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | 47 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
47 ngx_conf_set_msec_slot, | 48 ngx_conf_set_msec_slot, |
48 0, | 49 0, |
49 addressof(ngx_http_post_accept_timeout)}, | 50 addressof(ngx_http_post_accept_timeout), |
51 NULL}, | |
50 | 52 |
51 {ngx_string("connection_pool_size"), | 53 {ngx_string("connection_pool_size"), |
52 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | 54 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
53 ngx_conf_set_size_slot, | 55 ngx_conf_set_size_slot, |
54 0, | 56 0, |
55 addressof(ngx_http_connection_pool_size)}, | 57 addressof(ngx_http_connection_pool_size), |
58 NULL}, | |
56 | 59 |
57 {ngx_string("request_pool_size"), | 60 {ngx_string("request_pool_size"), |
58 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | 61 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
59 ngx_conf_set_size_slot, | 62 ngx_conf_set_size_slot, |
60 0, | 63 0, |
61 addressof(ngx_http_request_pool_size)}, | 64 addressof(ngx_http_request_pool_size), |
65 NULL}, | |
62 | 66 |
63 {ngx_string("client_header_timeout"), | 67 {ngx_string("client_header_timeout"), |
64 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | 68 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
65 ngx_conf_set_msec_slot, | 69 ngx_conf_set_msec_slot, |
66 0, | 70 0, |
67 addressof(ngx_http_client_header_timeout)}, | 71 addressof(ngx_http_client_header_timeout), |
72 NULL}, | |
68 | 73 |
69 {ngx_string("client_header_buffer_size"), | 74 {ngx_string("client_header_buffer_size"), |
70 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, | 75 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, |
71 ngx_conf_set_size_slot, | 76 ngx_conf_set_size_slot, |
72 0, | 77 0, |
73 addressof(ngx_http_client_header_buffer_size)}, | 78 addressof(ngx_http_client_header_buffer_size), |
79 NULL}, | |
74 | 80 |
75 {ngx_string("large_client_header"), | 81 {ngx_string("large_client_header"), |
76 NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG, | 82 NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG, |
77 ngx_conf_set_flag_slot, | 83 ngx_conf_set_flag_slot, |
78 0, | 84 0, |
79 addressof(ngx_http_large_client_header)}, | 85 addressof(ngx_http_large_client_header), |
86 NULL}, | |
80 | 87 |
81 {ngx_string("location"), | 88 {ngx_string("location"), |
82 NGX_HTTP_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE1, | 89 NGX_HTTP_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE1, |
83 ngx_location_block, | 90 ngx_location_block, |
84 NGX_HTTP_SRV_CONF_OFFSET, | 91 NGX_HTTP_SRV_CONF_OFFSET, |
85 0}, | 92 0, |
93 NULL}, | |
86 | 94 |
87 {ngx_string("listen"), | 95 {ngx_string("listen"), |
88 NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, | 96 NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
89 ngx_set_listen, | 97 ngx_set_listen, |
90 NGX_HTTP_SRV_CONF_OFFSET, | 98 NGX_HTTP_SRV_CONF_OFFSET, |
91 0}, | 99 0, |
100 NULL}, | |
92 | 101 |
93 {ngx_string("types"), | 102 {ngx_string("types"), |
94 NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, | 103 NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, |
95 ngx_types_block, | 104 ngx_types_block, |
96 NGX_HTTP_LOC_CONF_OFFSET, | 105 NGX_HTTP_LOC_CONF_OFFSET, |
97 0}, | 106 0, |
107 NULL}, | |
98 | 108 |
99 {ngx_string("root"), | 109 {ngx_string("root"), |
100 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 110 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
101 ngx_conf_set_str_slot, | 111 ngx_conf_set_str_slot, |
102 NGX_HTTP_LOC_CONF_OFFSET, | 112 NGX_HTTP_LOC_CONF_OFFSET, |
103 offsetof(ngx_http_core_loc_conf_t, doc_root)}, | 113 offsetof(ngx_http_core_loc_conf_t, doc_root), |
114 NULL}, | |
104 | 115 |
105 {ngx_string("sendfile"), | 116 {ngx_string("sendfile"), |
106 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 117 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
107 ngx_conf_set_flag_slot, | 118 ngx_conf_set_flag_slot, |
108 NGX_HTTP_LOC_CONF_OFFSET, | 119 NGX_HTTP_LOC_CONF_OFFSET, |
109 offsetof(ngx_http_core_loc_conf_t, sendfile)}, | 120 offsetof(ngx_http_core_loc_conf_t, sendfile), |
121 NULL}, | |
110 | 122 |
111 {ngx_string("send_timeout"), | 123 {ngx_string("send_timeout"), |
112 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 124 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
113 ngx_conf_set_msec_slot, | 125 ngx_conf_set_msec_slot, |
114 NGX_HTTP_LOC_CONF_OFFSET, | 126 NGX_HTTP_LOC_CONF_OFFSET, |
115 offsetof(ngx_http_core_loc_conf_t, send_timeout)}, | 127 offsetof(ngx_http_core_loc_conf_t, send_timeout), |
128 NULL}, | |
116 | 129 |
117 {ngx_string("lingering_time"), | 130 {ngx_string("lingering_time"), |
118 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 131 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
119 ngx_conf_set_msec_slot, | 132 ngx_conf_set_msec_slot, |
120 NGX_HTTP_LOC_CONF_OFFSET, | 133 NGX_HTTP_LOC_CONF_OFFSET, |
121 offsetof(ngx_http_core_loc_conf_t, lingering_time)}, | 134 offsetof(ngx_http_core_loc_conf_t, lingering_time), |
135 NULL}, | |
122 | 136 |
123 {ngx_string("lingering_timeout"), | 137 {ngx_string("lingering_timeout"), |
124 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 138 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
125 ngx_conf_set_msec_slot, | 139 ngx_conf_set_msec_slot, |
126 NGX_HTTP_LOC_CONF_OFFSET, | 140 NGX_HTTP_LOC_CONF_OFFSET, |
127 offsetof(ngx_http_core_loc_conf_t, lingering_timeout)}, | 141 offsetof(ngx_http_core_loc_conf_t, lingering_timeout), |
128 | 142 NULL}, |
129 {ngx_null_string, 0, NULL, 0, 0} | 143 |
144 {ngx_null_string, 0, NULL, 0, 0, NULL} | |
130 }; | 145 }; |
131 | 146 |
132 | 147 |
133 ngx_http_module_t ngx_http_core_module_ctx = { | 148 ngx_http_module_t ngx_http_core_module_ctx = { |
134 NGX_HTTP_MODULE, | 149 NGX_HTTP_MODULE, |
148 NGX_HTTP_MODULE_TYPE, /* module type */ | 163 NGX_HTTP_MODULE_TYPE, /* module type */ |
149 ngx_http_core_init /* init module */ | 164 ngx_http_core_init /* init module */ |
150 }; | 165 }; |
151 | 166 |
152 | 167 |
153 void ngx_http_handler(ngx_http_request_t *r) | 168 int ngx_http_find_server_conf(ngx_http_request_t *r) |
154 { | 169 { |
155 int rc, a, n, i; | 170 int a, n; |
156 ngx_http_handler_pt *h; | 171 socklen_t len; |
157 ngx_http_module_t *module; | 172 struct sockaddr_in addr_in; |
158 ngx_http_conf_ctx_t *ctx; | 173 ngx_http_in_port_t *in_port; |
159 ngx_http_in_port_t *in_port; | 174 ngx_http_in_addr_t *in_addr; |
160 ngx_http_in_addr_t *in_addr; | 175 ngx_http_conf_ctx_t *ctx; |
161 ngx_http_server_name_t *name; | 176 ngx_http_server_name_t *name; |
162 ngx_http_core_srv_conf_t *scf; | 177 |
163 ngx_http_core_loc_conf_t *lcf, **plcf; | 178 /* AF_INET only */ |
164 | 179 |
165 r->connection->unexpected_eof = 0; | 180 in_port = (ngx_http_in_port_t *) r->connection->servers; |
166 | 181 in_addr = (ngx_http_in_addr_t *) in_port->addrs.elts; |
167 r->keepalive = 0; | 182 |
168 r->lingering_close = 1; | 183 r->port = in_port->port; |
169 | 184 |
170 #if 0 | 185 a = 0; |
171 ngx_log_debug(r->connection->log, "servers: %0x" _ r->connection->servers); | 186 |
172 #endif | 187 if (in_port->addrs.nelts > 1) { |
173 | 188 |
174 /* find server config */ | 189 /* there're the several addresses on this port and one of them |
175 | 190 is "*:port" so getsockname() is needed to determine |
176 if (r->connection->servers == NULL) { | 191 the server address */ |
177 ctx = (ngx_http_conf_ctx_t *) r->connection->ctx; | 192 |
193 len = sizeof(struct sockaddr_in); | |
194 if (getsockname(r->connection->fd, (struct sockaddr *) &addr_in, &len) | |
195 == -1) { | |
196 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_socket_errno, | |
197 "getsockname() failed"); | |
198 return NGX_ERROR; | |
199 } | |
200 | |
201 r->in_addr = addr_in.sin_addr.s_addr; | |
202 | |
203 for ( /* void */ ; a < in_port->addrs.nelts; a++) { | |
204 if (in_addr[a].addr == r->in_addr) { | |
205 ngx_log_debug(r->connection->log, "FOUND"); | |
206 break; | |
207 } | |
208 } | |
209 | |
210 if (a == in_port->addrs.nelts) { | |
211 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | |
212 "addr not found"); | |
213 exit(1); | |
214 } | |
178 | 215 |
179 } else { | 216 } else { |
180 | 217 r->in_addr = in_addr[0].addr; |
181 /* AF_INET only */ | 218 } |
182 | 219 |
183 in_port = (ngx_http_in_port_t *) r->connection->servers; | 220 /* the default server configuration for this address:port */ |
184 in_addr = (ngx_http_in_addr_t *) in_port->addr.elts; | 221 ctx = in_addr[a].core_srv_conf->ctx; |
185 | 222 |
186 a = 0; | 223 if (r->headers_in.host_name_len > 0) { |
187 | 224 |
188 if (in_port->addr.nelts > 1) { | 225 /* find the name based server configuration */ |
189 /* find r->in_addr, getsockname() */ | 226 |
190 | 227 name = (ngx_http_server_name_t *) in_addr[a].names.elts; |
191 for ( /* void */ ; a < in_port->addr.nelts; a++) { | 228 for (n = 0; n < in_addr[a].names.nelts; n++) { |
192 | 229 if (r->headers_in.host_name_len != name[n].name.len) { |
193 if (in_addr[a].addr == INADDR_ANY) { | 230 continue; |
194 break; | 231 } |
195 } | 232 |
196 | 233 if (ngx_strncasecmp(r->headers_in.host->value.data, |
197 if (in_addr[a].addr == r->in_addr) { | 234 name[n].name.data, |
198 break; | 235 r->headers_in.host_name_len) == 0) { |
199 } | 236 ctx = name->core_srv_conf->ctx; |
200 } | 237 break; |
201 } | |
202 | |
203 ctx = in_addr[a].core_srv_conf->ctx; | |
204 | |
205 if (r->headers_in.host_name_len > 0) { | |
206 | |
207 name = (ngx_http_server_name_t *) in_addr[a].names.elts; | |
208 for (n = 0; n < in_addr[a].names.nelts; n++) { | |
209 if (r->headers_in.host_name_len != name[n].name.len) { | |
210 continue; | |
211 } | |
212 | |
213 if (ngx_strncasecmp(r->headers_in.host->value.data, | |
214 name[n].name.data, | |
215 r->headers_in.host_name_len) == 0) { | |
216 ctx = name->core_srv_conf->ctx; | |
217 break; | |
218 } | |
219 } | 238 } |
220 } | 239 } |
221 } | 240 } |
222 | 241 |
223 r->srv_conf = ctx->srv_conf; | 242 r->srv_conf = ctx->srv_conf; |
227 ngx_log_debug(r->connection->log, "cxt: %08x" _ ctx); | 246 ngx_log_debug(r->connection->log, "cxt: %08x" _ ctx); |
228 ngx_log_debug(r->connection->log, "srv_conf: %0x" _ r->srv_conf); | 247 ngx_log_debug(r->connection->log, "srv_conf: %0x" _ r->srv_conf); |
229 ngx_log_debug(r->connection->log, "loc_conf: %0x" _ r->loc_conf); | 248 ngx_log_debug(r->connection->log, "loc_conf: %0x" _ r->loc_conf); |
230 #endif | 249 #endif |
231 | 250 |
232 /* run rewrite url phase */ | 251 return NGX_OK; |
252 } | |
253 | |
254 | |
255 void ngx_http_handler(ngx_http_request_t *r) | |
256 { | |
257 int rc, i; | |
258 ngx_http_handler_pt *h; | |
259 ngx_http_module_t *module; | |
260 ngx_http_core_loc_conf_t *lcf, **plcf; | |
261 ngx_http_core_srv_conf_t *scf; | |
262 | |
263 r->connection->unexpected_eof = 0; | |
264 | |
265 r->keepalive = 0; | |
266 | |
267 if (r->headers_in.content_length_n > 0) { | |
268 r->lingering_close = 1; | |
269 } | |
270 | |
271 /* TEST STUB */ r->lingering_close = 1; | |
272 | |
273 | |
274 /* TODO: run rewrite url phase */ | |
233 | 275 |
234 | 276 |
235 /* find location config */ | 277 /* find location config */ |
236 | 278 |
237 scf = (ngx_http_core_srv_conf_t *) | 279 scf = (ngx_http_core_srv_conf_t *) |
381 | 423 |
382 r->file.info.dwFileAttributes = GetFileAttributes(r->file.name.data); | 424 r->file.info.dwFileAttributes = GetFileAttributes(r->file.name.data); |
383 if (r->file.info.dwFileAttributes == INVALID_FILE_ATTRIBUTES) { | 425 if (r->file.info.dwFileAttributes == INVALID_FILE_ATTRIBUTES) { |
384 err = ngx_errno; | 426 err = ngx_errno; |
385 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, | 427 ngx_log_error(NGX_LOG_ERR, r->connection->log, err, |
386 "ngx_http_core_translate_handler: " | |
387 ngx_file_type_n " \"%s\" failed", r->file.name.data); | 428 ngx_file_type_n " \"%s\" failed", r->file.name.data); |
388 | 429 |
389 if (err == NGX_ENOENT || err == NGX_ENOTDIR) { | 430 if (err == NGX_ENOENT || err == NGX_ENOTDIR) { |
390 return NGX_HTTP_NOT_FOUND; | 431 return NGX_HTTP_NOT_FOUND; |
391 | 432 |
404 } | 445 } |
405 | 446 |
406 if (r->file.fd == NGX_INVALID_FILE) { | 447 if (r->file.fd == NGX_INVALID_FILE) { |
407 err = ngx_errno; | 448 err = ngx_errno; |
408 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, | 449 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, |
409 "ngx_http_core_handler: " | |
410 ngx_open_file_n " \"%s\" failed", r->file.name.data); | 450 ngx_open_file_n " \"%s\" failed", r->file.name.data); |
411 | 451 |
412 if (err == NGX_ENOENT || err == NGX_ENOTDIR) { | 452 if (err == NGX_ENOENT || err == NGX_ENOTDIR) { |
413 return NGX_HTTP_NOT_FOUND; | 453 return NGX_HTTP_NOT_FOUND; |
414 | 454 |
421 } | 461 } |
422 | 462 |
423 if (!r->file.info_valid) { | 463 if (!r->file.info_valid) { |
424 if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) { | 464 if (ngx_stat_fd(r->file.fd, &r->file.info) == NGX_FILE_ERROR) { |
425 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, | 465 ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, |
426 "ngx_http_core_handler: " | |
427 ngx_stat_fd_n " \"%s\" failed", r->file.name.data); | 466 ngx_stat_fd_n " \"%s\" failed", r->file.name.data); |
428 | 467 |
429 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { | 468 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { |
430 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, | 469 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, |
431 "ngx_http_core_handler: " | |
432 ngx_close_file_n " \"%s\" failed", | 470 ngx_close_file_n " \"%s\" failed", |
433 r->file.name.data); | 471 r->file.name.data); |
434 } | 472 } |
435 | 473 |
436 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 474 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
444 ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data); | 482 ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data); |
445 | 483 |
446 #if !(WIN9X) | 484 #if !(WIN9X) |
447 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { | 485 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { |
448 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, | 486 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, |
449 "ngx_http_core_handler: " | |
450 ngx_close_file_n " \"%s\" failed", r->file.name.data); | 487 ngx_close_file_n " \"%s\" failed", r->file.name.data); |
451 } | 488 } |
452 #endif | 489 #endif |
453 | 490 |
454 /* BROKEN: need to include server name */ | 491 /* BROKEN: need to include server name */ |
840 | 877 |
841 ngx_test_null(lcf, | 878 ngx_test_null(lcf, |
842 ngx_pcalloc(pool, sizeof(ngx_http_core_loc_conf_t)), | 879 ngx_pcalloc(pool, sizeof(ngx_http_core_loc_conf_t)), |
843 NGX_CONF_ERROR); | 880 NGX_CONF_ERROR); |
844 | 881 |
845 /* | 882 /* set by ngx_pcalloc(): |
846 ngx_pcalloc(): | |
847 | 883 |
848 lcf->doc_root.len = 0; | 884 lcf->doc_root.len = 0; |
849 lcf->doc_root.data = NULL; | 885 lcf->doc_root.data = NULL; |
850 lcf->types = NULL; | 886 lcf->types = NULL; |
851 */ | 887 |
888 */ | |
852 | 889 |
853 lcf->sendfile = NGX_CONF_UNSET; | 890 lcf->sendfile = NGX_CONF_UNSET; |
854 | 891 |
855 lcf->send_timeout = NGX_CONF_UNSET; | 892 lcf->send_timeout = NGX_CONF_UNSET; |
856 lcf->discarded_buffer_size = NGX_CONF_UNSET; | 893 lcf->discarded_buffer_size = NGX_CONF_UNSET; |
931 } | 968 } |
932 | 969 |
933 | 970 |
934 static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) | 971 static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) |
935 { | 972 { |
973 uint p; | |
974 char *addr; | |
936 ngx_str_t *args; | 975 ngx_str_t *args; |
937 ngx_http_listen_t *ls; | 976 ngx_http_listen_t *ls; |
938 ngx_http_core_srv_conf_t *scf = (ngx_http_core_srv_conf_t *) conf; | 977 ngx_http_core_srv_conf_t *scf = (ngx_http_core_srv_conf_t *) conf; |
939 | 978 |
979 /* TODO: check duplicate 'listen' directives */ | |
980 | |
940 ngx_test_null(ls, ngx_push_array(&scf->listen), NGX_CONF_ERROR); | 981 ngx_test_null(ls, ngx_push_array(&scf->listen), NGX_CONF_ERROR); |
941 | 982 |
942 /* AF_INET only */ | 983 /* AF_INET only */ |
943 | 984 |
944 ls->family = AF_INET; | 985 ls->family = AF_INET; |
945 ls->addr = INADDR_ANY; | |
946 ls->flags = 0; | 986 ls->flags = 0; |
947 ls->file_name = cf->conf_file->file.name; | 987 ls->file_name = cf->conf_file->file.name; |
948 ls->line = cf->conf_file->line; | 988 ls->line = cf->conf_file->line; |
949 | 989 |
950 args = (ngx_str_t *) cf->args->elts; | 990 args = (ngx_str_t *) cf->args->elts; |
951 | 991 addr = args[1].data; |
952 ls->port = ngx_atoi(args[1].data, args[1].len); | 992 |
993 for (p = 0; p < args[1].len; p++) { | |
994 if (addr[p] == ':') { | |
995 addr[p++] = '\0'; | |
996 | |
997 ls->addr = inet_addr(addr); | |
998 if (ls->addr == INADDR_NONE) { | |
999 return "bad addr"; | |
1000 } | |
1001 | |
1002 break; | |
1003 } | |
1004 } | |
1005 | |
1006 if (p == args[1].len) { | |
1007 ls->addr = INADDR_ANY; | |
1008 p = 0; | |
1009 } | |
1010 | |
1011 ls->port = ngx_atoi(&addr[p], args[1].len - p); | |
953 if (ls->port < 1 || ls->port > 65536) { | 1012 if (ls->port < 1 || ls->port > 65536) { |
954 return "port must be between 1 and 65535"; | 1013 return "port must be between 1 and 65535"; |
955 } | 1014 } |
956 | 1015 |
957 return NGX_CONF_OK; | 1016 return NGX_CONF_OK; |