Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 103:6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Jun 2003 15:28:34 +0000 |
parents | 7ebc8b7fb816 |
children | 7db96f59bc29 |
comparison
equal
deleted
inserted
replaced
102:7e86d028d8f0 | 103:6dfda4cf5200 |
---|---|
1 | 1 |
2 #include <ngx_config.h> | 2 #include <ngx_config.h> |
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 | 4 #include <ngx_event.h> |
5 #include <ngx_listen.h> | |
6 | |
7 #include <ngx_http.h> | 5 #include <ngx_http.h> |
8 | 6 |
9 | 7 |
10 static void ngx_http_init_filters(ngx_pool_t *pool, ngx_module_t **modules); | |
11 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | 8 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
12 | 9 |
13 | 10 |
14 int ngx_http_max_module; | 11 int ngx_http_max_module; |
15 | 12 |
52 int mi, m, s, l, p, a, n; | 49 int mi, m, s, l, p, a, n; |
53 int port_found, addr_found, virtual_names; | 50 int port_found, addr_found, virtual_names; |
54 char *rv; | 51 char *rv; |
55 struct sockaddr_in *addr_in; | 52 struct sockaddr_in *addr_in; |
56 ngx_array_t in_ports; | 53 ngx_array_t in_ports; |
57 ngx_listen_t *ls; | 54 ngx_listening_t *ls; |
58 ngx_http_module_t *module; | 55 ngx_http_module_t *module; |
59 ngx_conf_t pcf; | 56 ngx_conf_t pcf; |
60 ngx_http_conf_ctx_t *ctx; | 57 ngx_http_conf_ctx_t *ctx; |
61 ngx_http_in_port_t *in_port, *inport; | 58 ngx_http_in_port_t *in_port, *inport; |
62 ngx_http_in_addr_t *in_addr, *inaddr; | 59 ngx_http_in_addr_t *in_addr, *inaddr; |
63 ngx_http_core_main_conf_t *cmcf; | 60 ngx_http_core_main_conf_t *cmcf; |
64 ngx_http_core_srv_conf_t **cscfp; | 61 ngx_http_core_srv_conf_t **cscfp, *cscf; |
65 ngx_http_core_loc_conf_t **clcfp; | 62 ngx_http_core_loc_conf_t **clcfp; |
66 ngx_http_listen_t *lscf; | 63 ngx_http_listen_t *lscf; |
67 ngx_http_server_name_t *s_name, *name; | 64 ngx_http_server_name_t *s_name, *name; |
65 #if (WIN32) | |
66 ngx_iocp_conf_t *iocpcf; | |
67 #endif | |
68 | 68 |
69 /* the main http context */ | 69 /* the main http context */ |
70 ngx_test_null(ctx, | 70 ngx_test_null(ctx, |
71 ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), | 71 ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), |
72 NGX_CONF_ERROR); | 72 NGX_CONF_ERROR); |
429 in_addr = in_port[p].addrs.elts; | 429 in_addr = in_port[p].addrs.elts; |
430 while (a < in_port[p].addrs.nelts) { | 430 while (a < in_port[p].addrs.nelts) { |
431 | 431 |
432 ngx_test_null(ls, ngx_push_array(&ngx_listening_sockets), | 432 ngx_test_null(ls, ngx_push_array(&ngx_listening_sockets), |
433 NGX_CONF_ERROR); | 433 NGX_CONF_ERROR); |
434 ngx_memzero(ls, sizeof(ngx_listen_t)); | 434 ngx_memzero(ls, sizeof(ngx_listening_t)); |
435 | 435 |
436 ngx_test_null(addr_in, | 436 ngx_test_null(addr_in, |
437 ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)), | 437 ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)), |
438 NGX_CONF_ERROR); | 438 NGX_CONF_ERROR); |
439 | 439 |
454 6, ":%d", in_port[p].port); | 454 6, ":%d", in_port[p].port); |
455 | 455 |
456 ls->family = AF_INET; | 456 ls->family = AF_INET; |
457 ls->type = SOCK_STREAM; | 457 ls->type = SOCK_STREAM; |
458 ls->protocol = IPPROTO_IP; | 458 ls->protocol = IPPROTO_IP; |
459 #if (NGX_OVERLAPPED) | 459 #if (WIN32) |
460 ls->flags = WSA_FLAG_OVERLAPPED; | 460 ls->flags = WSA_FLAG_OVERLAPPED; |
461 #endif | 461 #endif |
462 ls->sockaddr = (struct sockaddr *) addr_in; | 462 ls->sockaddr = (struct sockaddr *) addr_in; |
463 ls->socklen = sizeof(struct sockaddr_in); | 463 ls->socklen = sizeof(struct sockaddr_in); |
464 ls->addr = offsetof(struct sockaddr_in, sin_addr); | 464 ls->addr = offsetof(struct sockaddr_in, sin_addr); |
466 ls->backlog = -1; | 466 ls->backlog = -1; |
467 ls->nonblocking = 1; | 467 ls->nonblocking = 1; |
468 | 468 |
469 ls->handler = ngx_http_init_connection; | 469 ls->handler = ngx_http_init_connection; |
470 ls->log = cf->log; | 470 ls->log = cf->log; |
471 ls->pool_size = cmcf->connection_pool_size; | 471 |
472 ls->post_accept_timeout = cmcf->post_accept_timeout; | 472 cscf = in_addr[a].core_srv_conf; |
473 ls->pool_size = cscf->connection_pool_size; | |
474 ls->post_accept_timeout = cscf->post_accept_timeout; | |
475 | |
476 #if (WIN32) | |
477 iocpcf = ngx_event_get_conf(ngx_iocp_module); | |
478 if (iocpcf->acceptex_read) { | |
479 ls->post_accept_buffer_size = cscf->client_header_buffer_size; | |
480 } | |
481 #endif | |
482 | |
473 ls->ctx = ctx; | 483 ls->ctx = ctx; |
474 | 484 |
475 if (in_port[p].addrs.nelts > 1) { | 485 if (in_port[p].addrs.nelts > 1) { |
476 | 486 |
477 in_addr = in_port[p].addrs.elts; | 487 in_addr = in_port[p].addrs.elts; |