comparison src/http/ngx_http_core_module.c @ 67:5a7d1aaa1618

nginx-0.0.1-2003-03-11-23:38:13 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 11 Mar 2003 20:38:13 +0000
parents 34d647deb1da
children e43f406e4525
comparison
equal deleted inserted replaced
66:4876cd4a36bb 67:5a7d1aaa1618
94 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 94 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
95 ngx_conf_set_time_slot, 95 ngx_conf_set_time_slot,
96 NGX_HTTP_LOC_CONF_OFFSET, 96 NGX_HTTP_LOC_CONF_OFFSET,
97 offsetof(ngx_http_core_loc_conf_t, send_timeout)}, 97 offsetof(ngx_http_core_loc_conf_t, send_timeout)},
98 98
99 {ngx_string("lingering_time"),
100 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
101 ngx_conf_set_time_slot,
102 NGX_HTTP_LOC_CONF_OFFSET,
103 offsetof(ngx_http_core_loc_conf_t, lingering_time)},
104
105 {ngx_string("lingering_timeout"),
106 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
107 ngx_conf_set_time_slot,
108 NGX_HTTP_LOC_CONF_OFFSET,
109 offsetof(ngx_http_core_loc_conf_t, lingering_timeout)},
110
99 {ngx_string(""), 0, NULL, 0, 0} 111 {ngx_string(""), 0, NULL, 0, 0}
100 }; 112 };
101 113
102 114
103 ngx_http_module_t ngx_http_core_module_ctx = { 115 ngx_http_module_t ngx_http_core_module_ctx = {
136 ngx_http_server_name_t *name; 148 ngx_http_server_name_t *name;
137 149
138 r->connection->unexpected_eof = 0; 150 r->connection->unexpected_eof = 0;
139 151
140 r->lingering_close = 1; 152 r->lingering_close = 1;
141 r->keepalive = 1; 153 r->keepalive = 0;
142 154
143 #if 1 155 #if 1
144 r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY; 156 r->filter = NGX_HTTP_FILTER_NEED_IN_MEMORY;
145 #endif 157 #endif
146 158
261 273
262 if (rc == 0) { 274 if (rc == 0) {
263 r->loc_conf = lcf[i]->loc_conf; 275 r->loc_conf = lcf[i]->loc_conf;
264 } 276 }
265 } 277 }
278
279 #if 0
280 /* STUB */ r->handler = ngx_http_proxy_handler;
281 return NGX_OK;
282 #endif
266 283
267 if (r->uri.data[r->uri.len - 1] == '/') { 284 if (r->uri.data[r->uri.len - 1] == '/') {
268 r->handler = ngx_http_core_index_handler; 285 r->handler = ngx_http_core_index_handler;
269 return NGX_OK; 286 return NGX_OK;
270 } 287 }
502 } 519 }
503 520
504 521
505 int ngx_http_close_request(ngx_http_request_t *r) 522 int ngx_http_close_request(ngx_http_request_t *r)
506 { 523 {
524 ngx_connection_t *c;
507 ngx_http_log_ctx_t *ctx; 525 ngx_http_log_ctx_t *ctx;
508 526
509 ngx_log_debug(r->connection->log, "CLOSE#: %d" _ r->file.fd); 527 c = r->connection;
510 528
511 ngx_http_log_handler(r); 529 ngx_http_log_handler(r);
512
513 ngx_assert((r->file.fd != NGX_INVALID_FILE), /* void */ ; ,
514 r->connection->log, "file already closed");
515 530
516 if (r->file.fd != NGX_INVALID_FILE) { 531 if (r->file.fd != NGX_INVALID_FILE) {
517 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { 532 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) {
518 ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, 533 ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
519 ngx_close_file_n " failed"); 534 ngx_close_file_n " failed");
520 } 535 }
521 } 536 }
522 537
523 /*
524 if (r->logging)
525 ngx_http_log_request(r);
526 */
527
528 ctx = (ngx_http_log_ctx_t *) r->connection->log->data;
529
530 /* ctx->url was allocated from r->pool */ 538 /* ctx->url was allocated from r->pool */
539 ctx = (ngx_http_log_ctx_t *) c->log->data;
531 ctx->url = NULL; 540 ctx->url = NULL;
532 541
533 ngx_destroy_pool(r->pool); 542 ngx_destroy_pool(r->pool);
534 543
535 ngx_log_debug(r->connection->log, "http closed"); 544 if (c->read->timer_set) {
536 545 ngx_del_timer(c->read);
537 if (r->connection->read->timer_set) { 546 c->read->timer_set = 0;
538 ngx_del_timer(r->connection->read); 547 }
539 } 548
540 549 if (c->write->timer_set) {
541 if (r->connection->write->timer_set) { 550 ngx_del_timer(c->write);
542 ngx_del_timer(r->connection->write); 551 c->write->timer_set = 0;
543 } 552 }
553
554 ngx_log_debug(c->log, "http closed");
544 555
545 return NGX_DONE; 556 return NGX_DONE;
546 } 557 }
547 558
548 559
778 lcf->doc_root.len = 4; 789 lcf->doc_root.len = 4;
779 lcf->doc_root.data = "html"; 790 lcf->doc_root.data = "html";
780 791
781 lcf->send_timeout = 10; 792 lcf->send_timeout = 10;
782 lcf->discarded_buffer_size = 1500; 793 lcf->discarded_buffer_size = 1500;
783 lcf->lingering_time = 30; 794 lcf->lingering_time = 30000;
784 lcf->lingering_timeout = 5000; 795 lcf->lingering_timeout = 5000;
785 796
786 /* 797 /*
787 lcf->send_timeout = NGX_CONF_UNSET; 798 lcf->send_timeout = NGX_CONF_UNSET;
788 */ 799 */
807 ls->line = cf->conf_file->line; 818 ls->line = cf->conf_file->line;
808 819
809 args = (ngx_str_t *) cf->args->elts; 820 args = (ngx_str_t *) cf->args->elts;
810 821
811 ls->port = atoi(args[1].data); 822 ls->port = atoi(args[1].data);
812 if (ls->port < 0) { 823 if (ls->port < 1 || ls->port > 65536) {
813 return "port must be greater or equal to zero"; 824 return "port must be between 1 and 65535";
814 } 825 }
815 826
816 return NGX_CONF_OK; 827 return NGX_CONF_OK;
817 } 828 }