Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 218:05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 05 Jan 2004 20:55:48 +0000 |
parents | f1d0e5f09c1e |
children | 4f81b931e9ff |
comparison
equal
deleted
inserted
replaced
217:c5d1cdcb04ec | 218:05592fd7a436 |
---|---|
80 c->log->data = ctx; | 80 c->log->data = ctx; |
81 c->log->handler = ngx_http_log_error; | 81 c->log->handler = ngx_http_log_error; |
82 | 82 |
83 rev = c->read; | 83 rev = c->read; |
84 rev->event_handler = ngx_http_init_request; | 84 rev->event_handler = ngx_http_init_request; |
85 rev->log_error = NGX_ERROR_INFO; | |
85 | 86 |
86 if (rev->ready) { | 87 if (rev->ready) { |
87 /* deferred accept, aio, iocp, epoll */ | 88 /* deferred accept, aio, iocp, epoll */ |
88 ngx_http_init_request(rev); | 89 ngx_http_init_request(rev); |
89 return; | 90 return; |
894 | 895 |
895 if (r->connection->write->timer_set) { | 896 if (r->connection->write->timer_set) { |
896 ngx_del_timer(r->connection->write); | 897 ngx_del_timer(r->connection->write); |
897 } | 898 } |
898 | 899 |
900 if (r->connection->read->kq_eof) { | |
901 #if (NGX_KQUEUE) | |
902 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, | |
903 r->connection->read->kq_errno, | |
904 "kevent reported about closed connection by client"); | |
905 #endif | |
906 ngx_http_close_request(r, 0); | |
907 ngx_http_close_connection(r->connection); | |
908 return; | |
909 } | |
910 | |
899 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 911 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
900 | 912 |
901 if (r->keepalive != 0 && clcf->keepalive_timeout > 0) { | 913 if (r->keepalive != 0 && clcf->keepalive_timeout > 0) { |
902 ngx_http_set_keepalive(r); | 914 ngx_http_set_keepalive(r); |
903 | 915 |
1201 } | 1213 } |
1202 } | 1214 } |
1203 | 1215 |
1204 ctx->action = "keepalive"; | 1216 ctx->action = "keepalive"; |
1205 | 1217 |
1206 if (c->tcp_nopush) { | 1218 if (c->tcp_nopush == 1) { |
1207 if (ngx_tcp_push(c->fd) == NGX_ERROR) { | 1219 if (ngx_tcp_push(c->fd) == NGX_ERROR) { |
1208 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, | 1220 ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, |
1209 ngx_tcp_push_n " failed"); | 1221 ngx_tcp_push_n " failed"); |
1210 ngx_http_close_connection(c); | 1222 ngx_http_close_connection(c); |
1211 return; | 1223 return; |
1237 /* | 1249 /* |
1238 * MSIE closes a keepalive connection with RST flag | 1250 * MSIE closes a keepalive connection with RST flag |
1239 * so we ignore ECONNRESET here. | 1251 * so we ignore ECONNRESET here. |
1240 */ | 1252 */ |
1241 | 1253 |
1242 rev->ignore_econnreset = 1; | 1254 rev->log_error = NGX_ERROR_IGNORE_ECONNRESET; |
1243 ngx_set_socket_errno(0); | 1255 ngx_set_socket_errno(0); |
1244 n = ngx_recv(c, c->buffer->last, c->buffer->end - c->buffer->last); | 1256 n = ngx_recv(c, c->buffer->last, c->buffer->end - c->buffer->last); |
1245 rev->ignore_econnreset = 0; | 1257 rev->log_error = NGX_ERROR_INFO; |
1246 | 1258 |
1247 if (n == NGX_AGAIN) { | 1259 if (n == NGX_AGAIN) { |
1248 return; | 1260 return; |
1249 } | 1261 } |
1250 | 1262 |
1504 | 1516 |
1505 if (ngx_del_conn) { | 1517 if (ngx_del_conn) { |
1506 ngx_del_conn(c); | 1518 ngx_del_conn(c); |
1507 | 1519 |
1508 } else { | 1520 } else { |
1509 if (c->read->active) { | 1521 if (c->read->active || c->read->disabled) { |
1510 ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); | 1522 ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); |
1511 } | 1523 } |
1512 | 1524 |
1513 if (c->write->active) { | 1525 if (c->write->active || c->write->disabled) { |
1514 ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); | 1526 ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); |
1515 } | 1527 } |
1516 } | 1528 } |
1517 | 1529 |
1518 if (ngx_close_socket(c->fd) == -1) { | 1530 if (ngx_close_socket(c->fd) == -1) { |