nginx-0.0.3-2004-04-14-21:44:28 import
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index 0fd89c1..d7cbf96 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -262,6 +262,7 @@
     { ngx_string("Expires"), offsetof(ngx_http_proxy_headers_in_t, expires) },
     { ngx_string("Cache-Control"),
                         offsetof(ngx_http_proxy_headers_in_t, cache_control) },
+    { ngx_string("ETag"), offsetof(ngx_http_proxy_headers_in_t, etag) },
     { ngx_string("X-Accel-Expires"),
                       offsetof(ngx_http_proxy_headers_in_t, x_accel_expires) },
 
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h
index 853aa76..55eee74 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.h
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.h
@@ -114,6 +114,7 @@
 
     ngx_table_elt_t                 *expires;
     ngx_table_elt_t                 *cache_control;
+    ngx_table_elt_t                 *etag;
     ngx_table_elt_t                 *x_accel_expires;
 
     ngx_table_elt_t                 *connection;
diff --git a/src/http/modules/proxy/ngx_http_proxy_header.c b/src/http/modules/proxy/ngx_http_proxy_header.c
index 8c24a06..cb13034 100644
--- a/src/http/modules/proxy/ngx_http_proxy_header.c
+++ b/src/http/modules/proxy/ngx_http_proxy_header.c
@@ -20,6 +20,8 @@
     h = headers_in->headers.elts;
     for (i = 0; i < headers_in->headers.nelts; i++) {
 
+        /* ignore some headers */
+
         if (&h[i] == headers_in->connection) {
             continue;
         }
@@ -51,12 +53,18 @@
             }
         }
 
+
+        /* "Content-Type" is handled specially */
+
         if (&h[i] == headers_in->content_type) {
             r->headers_out.content_type = &h[i];
             r->headers_out.content_type->key.len = 0;
             continue;
         }
 
+
+        /* copy some header pointers and set up r->headers_out */
+
         if (!(ho = ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
         {
             return NGX_ERROR;
@@ -64,9 +72,30 @@
 
         *ho = h[i];
 
+        if (&h[i] == headers_in->expires) {
+            r->headers_out.expires = ho;
+            continue;
+        }
+
+        if (&h[i] == headers_in->cache_control) {
+            r->headers_out.cache_control = ho;
+            continue;
+        }
+
+        if (&h[i] == headers_in->etag) {
+            r->headers_out.etag = ho;
+            continue;
+        }
+
+        if (&h[i] == headers_in->last_modified) {
+            r->headers_out.last_modified = ho;
+            /* TODO: update r->headers_out.last_modified_time */
+            continue;
+        }
+
         /*
-         * ngx_http_header_filter() does not handle specially
-         * the following headers if they are set:
+         * ngx_http_header_filter() passes the following headers as is
+         * and does not handle them specially if they are set:
          *     r->headers_out.server,
          *     r->headers_out.date,
          *     r->headers_out.content_length
diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c
index 41946bf..60c9e8f 100644
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -338,9 +338,7 @@
 
     r->connection->read->event_handler = ngx_http_proxy_check_broken_connection;
 
-    if (ngx_event_flags & (NGX_USE_CLEAR_EVENT|NGX_HAVE_KQUEUE_EVENT)) {
-
-        /* kqueue allows to detect when client closes prematurely connection */
+    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
 
         r->connection->write->event_handler =
                                         ngx_http_proxy_check_broken_connection;
@@ -627,11 +625,6 @@
 
     if (rc == NGX_AGAIN) {
         ngx_add_timer(c->write, p->lcf->connect_timeout);
-
-        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                       "http proxy connect handler: " PTR_FMT,
-                       c->write->event_handler);
-
         return;
     }