nginx-0.0.3-2004-04-13-09:27:03 import
diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c
index ab0c192..f4e9936 100644
--- a/src/event/modules/ngx_epoll_module.c
+++ b/src/event/modules/ngx_epoll_module.c
@@ -434,10 +434,6 @@
             c->write->returned_instance = instance;
         }
 
-#if (NGX_DEBUG)
-        log = c->log ? c->log : cycle->log;
-#endif
-
         if (c->read->instance != instance) {
 
             /*
@@ -445,11 +441,15 @@
              * that was just closed in this iteration
              */
 
-            ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0,
+            ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                            "epoll: stale event " PTR_FMT, c);
             continue;
         }
 
+#if (NGX_DEBUG)
+        log = c->log ? c->log : cycle->log;
+#endif
+
         ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
                        "epoll: fd:%d ev:%04X d:" PTR_FMT,
                        c->fd, event_list[i].events, event_list[i].data);
diff --git a/src/event/ngx_event_accept.c b/src/event/ngx_event_accept.c
index 235ff7f..07fc6a3 100644
--- a/src/event/ngx_event_accept.c
+++ b/src/event/ngx_event_accept.c
@@ -328,7 +328,6 @@
     if (*ngx_accept_mutex == 0
         && ngx_atomic_cmp_set(ngx_accept_mutex, 0, ngx_pid))
     {
-
         ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
                        "accept mutex locked");
 
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index 84c9264..017d7c8 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -425,6 +425,10 @@
 
     n = recv(c->fd, buf, 1, MSG_PEEK);
 
+    if (ev->write && n >= 0) {
+        return;
+    }
+
     if (n > 0) {
         if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && ev->active) {
             if (ngx_del_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) {
diff --git a/src/os/unix/ngx_linux_init.c b/src/os/unix/ngx_linux_init.c
index 387a491..ea2e812 100644
--- a/src/os/unix/ngx_linux_init.c
+++ b/src/os/unix/ngx_linux_init.c
@@ -9,10 +9,15 @@
 
 ngx_os_io_t ngx_os_io = {
     ngx_unix_recv,
+    ngx_readv_chain,
     NULL,
-    NULL,
+#if (HAVE_SENDFILE)
     ngx_linux_sendfile_chain,
     NGX_IO_SENDFILE
+#else
+    ngx_writev_chain,
+    0
+#endif
 };
 
 
diff --git a/src/os/unix/ngx_solaris_init.c b/src/os/unix/ngx_solaris_init.c
index b2aba61..8f2e484 100644
--- a/src/os/unix/ngx_solaris_init.c
+++ b/src/os/unix/ngx_solaris_init.c
@@ -10,7 +10,7 @@
 
 ngx_os_io_t ngx_os_io = {
     ngx_unix_recv,
-    NULL,
+    ngx_readv_chain,
     NULL,
 #if (HAVE_SENDFILE)
     ngx_solaris_sendfilev_chain,