comparison src/event/modules/ngx_poll_module.c @ 32:da8c190bdaba NGINX_0_1_16

nginx 0.1.16 *) Bugfix: if the response were transferred by chunks, then on the HEAD request the final chunk was issued. *) Bugfix: the "Connection: keep-alive" header were issued, even if the keepalive_timeout directive forbade the keep-alive use. *) Bugfix: the errors in the ngx_http_fastcgi_module caused the segmentation faults. *) Bugfix: the compressed response encrypted by SSL may not transferred complete. *) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK options, are not used for the unix domain sockets. *) Feature: the rewrite directive supports the arguments rewriting. *) Bugfix: the response code 400 was returned for the POST request with the "Content-Length: 0" header; bug appeared in 0.1.14.
author Igor Sysoev <http://sysoev.ru>
date Tue, 25 Jan 2005 00:00:00 +0300
parents 46833bd150cb
children 6cfc63e68377
comparison
equal deleted inserted replaced
31:1b17dd824438 32:da8c190bdaba
260 } 260 }
261 261
262 262
263 static ngx_int_t ngx_poll_process_events(ngx_cycle_t *cycle) 263 static ngx_int_t ngx_poll_process_events(ngx_cycle_t *cycle)
264 { 264 {
265 int ready; 265 int ready, revents;
266 ngx_int_t i, nready; 266 ngx_int_t i, nready;
267 ngx_uint_t n, found, lock, expire; 267 ngx_uint_t n, found, lock, expire;
268 ngx_msec_t timer; 268 ngx_msec_t timer;
269 ngx_err_t err; 269 ngx_err_t err;
270 ngx_cycle_t **old_cycle; 270 ngx_cycle_t **old_cycle;
376 lock = 1; 376 lock = 1;
377 nready = 0; 377 nready = 0;
378 378
379 for (i = 0; i < nevents && ready; i++) { 379 for (i = 0; i < nevents && ready; i++) {
380 380
381 revents = event_list[i].revents;
382
381 #if 0 383 #if 0
382 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 384 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
383 "poll: %d: fd:%d ev:%04Xd rev:%04Xd", 385 "poll: %d: fd:%d ev:%04Xd rev:%04Xd",
384 i, event_list[i].fd, 386 i, event_list[i].fd, event_list[i].events, revents);
385 event_list[i].events, event_list[i].revents);
386 #else 387 #else
387 if (event_list[i].revents) { 388 if (revents) {
388 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 389 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
389 "poll: %d: fd:%d ev:%04Xd rev:%04Xd", 390 "poll: %d: fd:%d ev:%04Xd rev:%04Xd",
390 i, event_list[i].fd, 391 i, event_list[i].fd, event_list[i].events, revents);
391 event_list[i].events, event_list[i].revents); 392 }
392 } 393 #endif
393 #endif 394
394 395 if (revents & POLLNVAL) {
395 if (event_list[i].revents & POLLNVAL) {
396 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, 396 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
397 "poll() error fd:%d ev:%04Xd rev:%04Xd", 397 "poll() error fd:%d ev:%04Xd rev:%04Xd",
398 event_list[i].fd, 398 event_list[i].fd, event_list[i].events, revents);
399 event_list[i].events, event_list[i].revents); 399 }
400 } 400
401 401 if (revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL)) {
402 if (event_list[i].revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL))
403 {
404 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, 402 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
405 "strange poll() events fd:%d ev:%04Xd rev:%04Xd", 403 "strange poll() events fd:%d ev:%04Xd rev:%04Xd",
406 event_list[i].fd, 404 event_list[i].fd, event_list[i].events, revents);
407 event_list[i].events, event_list[i].revents);
408 } 405 }
409 406
410 if (event_list[i].fd == -1) { 407 if (event_list[i].fd == -1) {
411 /* 408 /*
412 * the disabled event, a workaround for our possible bug, 409 * the disabled event, a workaround for our possible bug,
445 } 442 }
446 443
447 continue; 444 continue;
448 } 445 }
449 446
447 if ((revents & (POLLERR|POLLHUP|POLLNVAL))
448 && (revents & (POLLIN|POLLOUT)) == 0)
449 {
450 /*
451 * if the error events were returned without POLLIN or POLLOUT,
452 * then add these flags to handle the events at least in one
453 * active handler
454 */
455
456 revents |= POLLIN|POLLOUT;
457 }
458
450 found = 0; 459 found = 0;
451 460
452 if (event_list[i].revents & (POLLIN|POLLERR|POLLHUP|POLLNVAL)) { 461 if (revents & POLLIN) {
453 found = 1; 462 found = 1;
454 463
455 ev = c->read; 464 ev = c->read;
456 ev->ready = 1; 465 ev->ready = 1;
457 466
472 #if 0 481 #if 0
473 ready_index[nready++] = c->read; 482 ready_index[nready++] = c->read;
474 #endif 483 #endif
475 } 484 }
476 485
477 if (event_list[i].revents & (POLLOUT|POLLERR|POLLHUP|POLLNVAL)) { 486 if (revents & POLLOUT) {
478 found = 1; 487 found = 1;
479 ev = c->write; 488 ev = c->write;
480 ev->ready = 1; 489 ev->ready = 1;
481 490
482 if (ev->oneshot) { 491 if (ev->oneshot) {