comparison src/http/ngx_http_event.c @ 119:cd54bcbaf3b5

nginx-0.0.1-2003-07-21-01:15:59 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 20 Jul 2003 21:15:59 +0000
parents ac69ab96328d
children e29909bd9b8a
comparison
equal deleted inserted replaced
118:5bf52498665c 119:cd54bcbaf3b5
63 63
64 void ngx_http_init_connection(ngx_connection_t *c) 64 void ngx_http_init_connection(ngx_connection_t *c)
65 { 65 {
66 int event; 66 int event;
67 ngx_event_t *rev; 67 ngx_event_t *rev;
68 ngx_http_log_ctx_t *lcx; 68 ngx_http_log_ctx_t *lctx;
69 69
70 c->addr_text.data = ngx_palloc(c->pool, c->listening->addr_text_max_len); 70 c->addr_text.data = ngx_palloc(c->pool, c->listening->addr_text_max_len);
71 if (c->addr_text.data == NULL) { 71 if (c->addr_text.data == NULL) {
72 ngx_http_close_connection(c); 72 ngx_http_close_connection(c);
73 return; 73 return;
79 if (c->addr_text.len == 0) { 79 if (c->addr_text.len == 0) {
80 ngx_http_close_connection(c); 80 ngx_http_close_connection(c);
81 return; 81 return;
82 } 82 }
83 83
84 lcx = ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t)); 84 lctx = ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t));
85 if (lcx == NULL) { 85 if (lctx == NULL) {
86 ngx_http_close_connection(c); 86 ngx_http_close_connection(c);
87 return; 87 return;
88 } 88 }
89 89
90 lcx->client = c->addr_text.data; 90 lctx->client = c->addr_text.data;
91 lcx->action = "reading client request line"; 91 lctx->action = "reading client request line";
92 c->log->data = lcx; 92 c->log->data = lctx;
93 c->log->handler = ngx_http_log_error; 93 c->log->handler = ngx_http_log_error;
94 94
95 rev = c->read; 95 rev = c->read;
96 rev->event_handler = ngx_http_init_request; 96 rev->event_handler = ngx_http_init_request;
97 97
134 ngx_http_request_t *r; 134 ngx_http_request_t *r;
135 ngx_http_in_port_t *in_port; 135 ngx_http_in_port_t *in_port;
136 ngx_http_in_addr_t *in_addr; 136 ngx_http_in_addr_t *in_addr;
137 ngx_http_server_name_t *server_name; 137 ngx_http_server_name_t *server_name;
138 ngx_http_core_srv_conf_t *cscf; 138 ngx_http_core_srv_conf_t *cscf;
139 ngx_http_core_loc_conf_t *clcf;
139 140
140 c = rev->data; 141 c = rev->data;
141 142
142 r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t)); 143 r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t));
143 if (r == NULL) { 144 if (r == NULL) {
210 r->loc_conf = cscf->ctx->loc_conf; 211 r->loc_conf = cscf->ctx->loc_conf;
211 212
212 server_name = cscf->server_names.elts; 213 server_name = cscf->server_names.elts;
213 r->server_name = &server_name->name; 214 r->server_name = &server_name->name;
214 215
216 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
217 c->log->file = clcf->err_log->file;
218 c->log->log_level = clcf->err_log->log_level;
219
215 if (c->buffer == NULL) { 220 if (c->buffer == NULL) {
216 c->buffer = ngx_create_temp_hunk(c->pool, 221 c->buffer = ngx_create_temp_hunk(c->pool,
217 cscf->client_header_buffer_size, 222 cscf->client_header_buffer_size,
218 0, 0); 223 0, 0);
219 if (c->buffer == NULL) { 224 if (c->buffer == NULL) {
263 { 268 {
264 int rc, offset; 269 int rc, offset;
265 ssize_t n; 270 ssize_t n;
266 ngx_connection_t *c; 271 ngx_connection_t *c;
267 ngx_http_request_t *r; 272 ngx_http_request_t *r;
268 ngx_http_log_ctx_t *lcx; 273 ngx_http_log_ctx_t *lctx;
269 ngx_http_core_srv_conf_t *cscf; 274 ngx_http_core_srv_conf_t *cscf;
270 275
271 c = rev->data; 276 c = rev->data;
272 r = c->data; 277 r = c->data;
273 278
419 rev->event_handler = ngx_http_block_read; 424 rev->event_handler = ngx_http_block_read;
420 ngx_http_handler(r); 425 ngx_http_handler(r);
421 return; 426 return;
422 } 427 }
423 428
424 lcx = c->log->data; 429 lctx = c->log->data;
425 lcx->action = "reading client request headers"; 430 lctx->action = "reading client request headers";
426 lcx->url = r->unparsed_uri.data; 431 lctx->url = r->unparsed_uri.data;
427 r->headers_in.headers = ngx_create_table(r->pool, 10); 432 r->headers_in.headers = ngx_create_table(r->pool, 10);
428 433
429 if (cscf->large_client_header 434 if (cscf->large_client_header
430 && r->header_in->pos == r->header_in->last) 435 && r->header_in->pos == r->header_in->last)
431 { 436 {
503 ngx_table_elt_t *h; 508 ngx_table_elt_t *h;
504 ngx_connection_t *c; 509 ngx_connection_t *c;
505 ngx_http_request_t *r; 510 ngx_http_request_t *r;
506 ngx_http_server_name_t *name; 511 ngx_http_server_name_t *name;
507 ngx_http_core_srv_conf_t *cscf; 512 ngx_http_core_srv_conf_t *cscf;
513 ngx_http_core_loc_conf_t *clcf;
508 514
509 c = rev->data; 515 c = rev->data;
510 r = c->data; 516 r = c->data;
511 517
512 ngx_log_debug(rev->log, "http process request header line"); 518 ngx_log_debug(rev->log, "http process request header line");
617 name[i].name.data, 623 name[i].name.data,
618 r->headers_in.host_name_len) == 0) 624 r->headers_in.host_name_len) == 0)
619 { 625 {
620 r->srv_conf = name[i].core_srv_conf->ctx->srv_conf; 626 r->srv_conf = name[i].core_srv_conf->ctx->srv_conf;
621 r->loc_conf = name[i].core_srv_conf->ctx->loc_conf; 627 r->loc_conf = name[i].core_srv_conf->ctx->loc_conf;
628
629 clcf = ngx_http_get_module_loc_conf(r,
630 ngx_http_core_module);
631 c->log->file = clcf->err_log->file;
632 c->log->log_level = clcf->err_log->log_level;
633
622 break; 634 break;
623 } 635 }
624 } 636 }
625 637
626 } else { 638 } else {