diff src/http/ngx_http_header_filter.c @ 135:e29909bd9b8a

nginx-0.0.1-2003-09-28-23:29:06 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 28 Sep 2003 19:29:06 +0000
parents d7f606e25b99
children 5526213be452
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -96,7 +96,6 @@ static ngx_str_t http_codes[] = {
 static int ngx_http_header_filter(ngx_http_request_t *r)
 {
     int                len, status, i;
-    time_t             ims;
     ngx_hunk_t        *h;
     ngx_chain_t       *ch;
     ngx_table_elt_t   *header;
@@ -130,26 +129,6 @@ static int ngx_http_header_filter(ngx_ht
        and 2 is for end of header */
     len = 9 + 2 + 2;
 
-    if (r->headers_in.if_modified_since && r->headers_out.status == NGX_HTTP_OK)
-    {
-        /* TODO: check LM header */
-        if (r->headers_out.last_modified_time) {
-            ims = ngx_http_parse_time(
-                                  r->headers_in.if_modified_since->value.data,
-                                  r->headers_in.if_modified_since->value.len);
-
-            ngx_log_debug(r->connection->log, "%d %d" _
-                          ims _ r->headers_out.last_modified_time);
-
-            /* I think that the date equality is correcter */
-            if (ims != NGX_ERROR && ims == r->headers_out.last_modified_time) {
-                r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
-                r->headers_out.content_length = -1;
-                r->headers_out.content_type->key.len = 0;
-            }
-        }
-    }
-
     /* status line */
     if (r->headers_out.status_line.len) {
         len += r->headers_out.status_line.len;
@@ -207,7 +186,7 @@ static int ngx_http_header_filter(ngx_ht
 
     if (r->headers_out.content_type && r->headers_out.content_type->value.len) {
         r->headers_out.content_type->key.len = 0;
-        len += 16 + r->headers_out.content_type->value.len;
+        len += 14 + r->headers_out.content_type->value.len + 2;
 
         if (r->headers_out.charset.len) {
             /* "; charset= ... " */
@@ -215,6 +194,12 @@ static int ngx_http_header_filter(ngx_ht
         }
     }
 
+    if (r->headers_out.content_encoding
+        && r->headers_out.content_encoding->value.len)
+    {
+        len += 18 + r->headers_out.content_encoding->value.len + 2;
+    }
+
     if (r->headers_out.location
         && r->headers_out.location->value.len
         && r->headers_out.location->value.data[0] == '/')
@@ -316,6 +301,17 @@ static int ngx_http_header_filter(ngx_ht
         *(h->last++) = CR; *(h->last++) = LF;
     }
 
+    if (r->headers_out.content_encoding
+        && r->headers_out.content_encoding->value.len)
+    {
+        h->last = ngx_cpymem(h->last, "Content-Encoding: ", 18);
+        h->last = ngx_cpymem(h->last,
+                             r->headers_out.content_encoding->value.data,
+                             r->headers_out.content_encoding->value.len);
+
+        *(h->last++) = CR; *(h->last++) = LF;
+    }
+
     if (r->headers_out.location
         && r->headers_out.location->value.len
         && r->headers_out.location->value.data[0] == '/')