I have made this patch, but not sure if it is correct.
diff -u nginx-1.0.6/src/http/ngx_http_upstream.c nginx-1.0.6_/src/http/ngx_http_upstream.c
--- nginx-1.0.6/src/http/ngx_http_upstream.c 2011-08-29 05:56:09.000000000 -0700
+++ nginx-1.0.6_/src/http/ngx_http_upstream.c 2011-11-11 02:17:36.000000000 -0800
@@ -1048,6 +1048,8 @@
ev->eof = 1;
c->error = 1;
+ u->abort_request(r);
+
if (!u->cacheable && u->peer.connection) {
ngx_log_error(NGX_LOG_INFO, ev->log, err,
"client closed prematurely connection, "