nginx-0.0.7-2004-06-25-18:42:03 import
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 6a7f7c3..8ce73cf 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1013,6 +1013,7 @@
     }
 
     if (r->connection->write->timer_set) {
+        r->connection->write->delayed = 0;
         ngx_del_timer(r->connection->write);
     }
 
@@ -1055,12 +1056,12 @@
     wev = r->connection->write;
     wev->event_handler = ngx_http_writer;
 
+    r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
+
     if (wev->ready && wev->delayed) {
         return;
     }
 
-    r->http_state = NGX_HTTP_WRITING_REQUEST_STATE;
-
     clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
                                         ngx_http_core_module);
     if (!wev->delayed) {