comparison src/http/ngx_http_upstream.c @ 671:cec32b3753ac release-0.3.57

nginx-0.3.57-RELEASE import *) Feature: the $ssl_client_serial variable. *) Bugfix: in the "!-e" operator of the "if" directive. Thanks to Andrian Budanstov. *) Bugfix: while a client certificate verification nginx did not send to a client the required certificates information. *) Bugfix: the $document_root variable did not support the variables in the "root" directive.
author Igor Sysoev <igor@sysoev.ru>
date Wed, 09 Aug 2006 19:59:45 +0000
parents 63a820b0bc6c
children b80f94fa2197
comparison
equal deleted inserted replaced
670:ba43c68592d0 671:cec32b3753ac
767 767
768 768
769 static void 769 static void
770 ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u) 770 ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u)
771 { 771 {
772 int rc; 772 int rc, err;
773 socklen_t len;
773 ngx_connection_t *c; 774 ngx_connection_t *c;
774 775
775 c = u->peer.connection; 776 c = u->peer.connection;
776 777
777 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, 778 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
778 "http upstream send request"); 779 "http upstream send request");
779 780
781 if (!u->request_sent) {
782
780 #if (NGX_HAVE_KQUEUE) 783 #if (NGX_HAVE_KQUEUE)
781 784
782 if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) 785 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
783 && !u->request_sent 786 if (c->write->pending_eof) {
784 && c->write->pending_eof) 787 (void) ngx_connection_error(c, c->write->kq_errno,
785 {
786 (void) ngx_connection_error(c, c->write->kq_errno,
787 "kevent() reported that connect() failed"); 788 "kevent() reported that connect() failed");
788 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); 789 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
789 return; 790 return;
790 } 791 }
791 792
793 } else
792 #endif 794 #endif
795 {
796 err = 0;
797 len = sizeof(int);
798
799 /*
800 * BSDs and Linux return 0 and set a pending error in err
801 * Solaris returns -1 and sets errno
802 */
803
804 if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len)
805 == -1)
806 {
807 err = ngx_errno;
808 }
809
810 if (err) {
811 (void) ngx_connection_error(c, err, "connect() failed");
812 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
813 return;
814 }
815 }
816 }
793 817
794 c->log->action = "sending request to upstream"; 818 c->log->action = "sending request to upstream";
795 819
796 rc = ngx_output_chain(&u->output, u->request_sent ? NULL : u->request_bufs); 820 rc = ngx_output_chain(&u->output, u->request_sent ? NULL : u->request_bufs);
797 821