Mercurial > hg > nginx-vendor-0-8
comparison src/event/ngx_event_openssl.c @ 330:5e3b425174f6 NGINX_0_6_9
nginx 0.6.9
*) Bugfix: a worker process may got caught in an endless loop, if the
HTTPS protocol was used; bug appeared in 0.6.7.
*) Bugfix: if server listened on two addresses or ports and trailing
wildcard was used, then nginx did not run.
*) Bugfix: the "ip_hash" directive might incorrectly mark servers as
down.
*) Bugfix: nginx could not be built on amd64; bug appeared in 0.6.8.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 28 Aug 2007 00:00:00 +0400 |
parents | f7cd062ee035 |
children | 3a91bfeffaba |
comparison
equal
deleted
inserted
replaced
329:f2f8dc3e7933 | 330:5e3b425174f6 |
---|---|
591 ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size) | 591 ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size) |
592 { | 592 { |
593 int n, bytes; | 593 int n, bytes; |
594 | 594 |
595 if (c->ssl->last == NGX_ERROR) { | 595 if (c->ssl->last == NGX_ERROR) { |
596 c->read->error = 1; | |
596 return NGX_ERROR; | 597 return NGX_ERROR; |
597 } | 598 } |
598 | 599 |
599 if (c->ssl->last == NGX_DONE) { | 600 if (c->ssl->last == NGX_DONE) { |
601 c->read->ready = 0; | |
602 c->read->eof = 1; | |
600 return 0; | 603 return 0; |
601 } | 604 } |
602 | 605 |
603 bytes = 0; | 606 bytes = 0; |
604 | 607 |
617 bytes += n; | 620 bytes += n; |
618 } | 621 } |
619 | 622 |
620 c->ssl->last = ngx_ssl_handle_recv(c, n); | 623 c->ssl->last = ngx_ssl_handle_recv(c, n); |
621 | 624 |
622 if (c->ssl->last != NGX_OK) { | 625 if (c->ssl->last == NGX_OK) { |
623 | 626 |
624 if (bytes) { | 627 size -= n; |
628 | |
629 if (size == 0) { | |
625 return bytes; | 630 return bytes; |
626 } | 631 } |
627 | 632 |
628 if (c->ssl->last == NGX_DONE) { | 633 buf += n; |
629 return 0; | 634 |
630 } | 635 continue; |
631 | 636 } |
637 | |
638 if (bytes) { | |
639 return bytes; | |
640 } | |
641 | |
642 switch (c->ssl->last) { | |
643 | |
644 case NGX_DONE: | |
645 c->read->ready = 0; | |
646 c->read->eof = 1; | |
647 return 0; | |
648 | |
649 case NGX_ERROR: | |
650 c->read->error = 1; | |
651 | |
652 /* fall thruogh */ | |
653 | |
654 case NGX_AGAIN: | |
632 return c->ssl->last; | 655 return c->ssl->last; |
633 } | 656 } |
634 | |
635 size -= n; | |
636 | |
637 if (size == 0) { | |
638 return bytes; | |
639 } | |
640 | |
641 buf += n; | |
642 } | 657 } |
643 } | 658 } |
644 | 659 |
645 | 660 |
646 static ngx_int_t | 661 static ngx_int_t |
701 return NGX_AGAIN; | 716 return NGX_AGAIN; |
702 } | 717 } |
703 | 718 |
704 c->ssl->no_wait_shutdown = 1; | 719 c->ssl->no_wait_shutdown = 1; |
705 c->ssl->no_send_shutdown = 1; | 720 c->ssl->no_send_shutdown = 1; |
706 c->read->eof = 1; | |
707 | 721 |
708 if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) { | 722 if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) { |
709 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, | 723 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
710 "peer shutdown SSL cleanly"); | 724 "peer shutdown SSL cleanly"); |
711 return NGX_DONE; | 725 return NGX_DONE; |
712 } | 726 } |
713 | 727 |
714 c->read->error = 1; | |
715 ngx_ssl_connection_error(c, sslerr, err, "SSL_read() failed"); | 728 ngx_ssl_connection_error(c, sslerr, err, "SSL_read() failed"); |
716 | 729 |
717 return NGX_ERROR; | 730 return NGX_ERROR; |
718 } | 731 } |
719 | 732 |