Mercurial > hg > nginx-vendor-current
comparison src/core/ngx_inet.c @ 50:72eb30262aac NGINX_0_1_25
nginx 0.1.25
*) Bugfix: nginx did run on Linux parisc.
*) Feature: nginx now does not start under FreeBSD if the sysctl
kern.ipc.somaxconn value is too big.
*) Bugfix: if a request was internally redirected by the
ngx_http_index_module module to the ngx_http_proxy_module or
ngx_http_fastcgi_module modules, then the index file was not closed
after request completion.
*) Feature: the "proxy_pass" can be used in location with regular
expression.
*) Feature: the ngx_http_rewrite_filter_module module supports the
condition like "if ($HTTP_USER_AGENT ~ MSIE)".
*) Bugfix: nginx started too slow if the large number of addresses and
text values were used in the "geo" directive.
*) Change: a variable name must be declared as "$name" in the "geo"
directive. The previous variant without "$" is still supported, but
will be removed soon.
*) Feature: the "%{VARIABLE}v" logging parameter.
*) Feature: the "set $name value" directive.
*) Bugfix: gcc 4.0 compatibility.
*) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Sat, 19 Mar 2005 00:00:00 +0300 |
parents | a39d1b793287 |
children | b55cbf18157e |
comparison
equal
deleted
inserted
replaced
49:93dabbc9efb9 | 50:72eb30262aac |
---|---|
242 return NULL; | 242 return NULL; |
243 } | 243 } |
244 | 244 |
245 u->port = u->default_port_value; | 245 u->port = u->default_port_value; |
246 | 246 |
247 if (!(u->port_text.data = ngx_palloc(cf->pool, sizeof("65536") - 1))) { | 247 u->port_text.data = ngx_palloc(cf->pool, sizeof("65536") - 1); |
248 if (u->port_text.data == NULL) { | |
248 return NULL; | 249 return NULL; |
249 } | 250 } |
250 | 251 |
251 u->port_text.len = ngx_sprintf(u->port_text.data, "%d", | 252 u->port_text.len = ngx_sprintf(u->port_text.data, "%d", |
252 u->default_port_value) | 253 u->default_port_value) |
269 return NULL; | 270 return NULL; |
270 } | 271 } |
271 | 272 |
272 u->port = htons(u->port); | 273 u->port = htons(u->port); |
273 | 274 |
274 if (!(host = ngx_palloc(cf->pool, u->host.len + 1))) { | 275 host = ngx_palloc(cf->pool, u->host.len + 1); |
276 if (host == NULL) { | |
275 return NULL; | 277 return NULL; |
276 } | 278 } |
277 | 279 |
278 ngx_cpystrn(host, u->host.data, u->host.len + 1); | 280 ngx_cpystrn(host, u->host.data, u->host.len + 1); |
279 | 281 |
295 | 297 |
296 /* MP: ngx_shared_palloc() */ | 298 /* MP: ngx_shared_palloc() */ |
297 | 299 |
298 peers = ngx_pcalloc(cf->pool, | 300 peers = ngx_pcalloc(cf->pool, |
299 sizeof(ngx_peers_t) + sizeof(ngx_peer_t) * (i - 1)); | 301 sizeof(ngx_peers_t) + sizeof(ngx_peer_t) * (i - 1)); |
300 | |
301 if (peers == NULL) { | 302 if (peers == NULL) { |
302 return NULL; | 303 return NULL; |
303 } | 304 } |
304 | 305 |
305 peers->number = i; | 306 peers->number = i; |
306 peers->weight = 1; | 307 peers->weight = 1; |
307 | 308 |
308 for (i = 0; h->h_addr_list[i] != NULL; i++) { | 309 for (i = 0; h->h_addr_list[i] != NULL; i++) { |
309 | 310 |
310 if (!(sin = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)))) { | 311 sin = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)); |
312 if (sin == NULL) { | |
311 return NULL; | 313 return NULL; |
312 } | 314 } |
313 | 315 |
314 sin->sin_family = AF_INET; | 316 sin->sin_family = AF_INET; |
315 sin->sin_port = u->port; | 317 sin->sin_port = u->port; |
318 peers->peer[i].sockaddr = (struct sockaddr *) sin; | 320 peers->peer[i].sockaddr = (struct sockaddr *) sin; |
319 peers->peer[i].socklen = sizeof(struct sockaddr_in); | 321 peers->peer[i].socklen = sizeof(struct sockaddr_in); |
320 | 322 |
321 len = INET_ADDRSTRLEN - 1 + 1 + u->port_text.len; | 323 len = INET_ADDRSTRLEN - 1 + 1 + u->port_text.len; |
322 | 324 |
323 if (!(peers->peer[i].name.data = ngx_palloc(cf->pool, len))) { | 325 peers->peer[i].name.data = ngx_palloc(cf->pool, len); |
326 if (peers->peer[i].name.data == NULL) { | |
324 return NULL; | 327 return NULL; |
325 } | 328 } |
326 | 329 |
327 len = ngx_sock_ntop(AF_INET, (struct sockaddr *) sin, | 330 len = ngx_sock_ntop(AF_INET, (struct sockaddr *) sin, |
328 peers->peer[i].name.data, len); | 331 peers->peer[i].name.data, len); |
343 | 346 |
344 } else { | 347 } else { |
345 | 348 |
346 /* MP: ngx_shared_palloc() */ | 349 /* MP: ngx_shared_palloc() */ |
347 | 350 |
348 if (!(peers = ngx_pcalloc(cf->pool, sizeof(ngx_peers_t)))) { | 351 peers = ngx_pcalloc(cf->pool, sizeof(ngx_peers_t)); |
349 return NULL; | 352 if (peers == NULL) { |
350 } | 353 return NULL; |
351 | 354 } |
352 if (!(sin = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)))) { | 355 |
356 sin = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)); | |
357 if (sin == NULL) { | |
353 return NULL; | 358 return NULL; |
354 } | 359 } |
355 | 360 |
356 peers->number = 1; | 361 peers->number = 1; |
357 | 362 |
364 | 369 |
365 len = u->host.len + 1 + u->port_text.len; | 370 len = u->host.len + 1 + u->port_text.len; |
366 | 371 |
367 peers->peer[0].name.len = len; | 372 peers->peer[0].name.len = len; |
368 | 373 |
369 if (!(peers->peer[0].name.data = ngx_palloc(cf->pool, len))) { | 374 peers->peer[0].name.data = ngx_palloc(cf->pool, len); |
375 if (peers->peer[0].name.data == NULL) { | |
370 return NULL; | 376 return NULL; |
371 } | 377 } |
372 | 378 |
373 len = u->host.len; | 379 len = u->host.len; |
374 | 380 |