diff src/http/ngx_http_header_filter.c @ 13:2aba961a1d34

nginx-0.0.1-2002-09-16-19:01:44 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 16 Sep 2002 15:01:44 +0000
parents 4f3879d9b6f6
children d7908993fdeb
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -31,14 +31,20 @@ int ngx_http_header_filter(ngx_http_requ
 
     status = r->headers_out->status - NGX_HTTP_OK;
 
-    ngx_memcpy(h->last.mem, "HTTP/1.0 ", 9);
+    ngx_memcpy(h->last.mem, "HTTP/1.1 ", 9);
     h->last.mem += 9;
     ngx_memcpy(h->last.mem, http_codes[status].line, http_codes[status].len);
     h->last.mem += http_codes[status].len;
     *(h->last.mem++) = CR; *(h->last.mem++) = LF;
 
+#if 1
+    r->keepalive = 1;
+    ngx_memcpy(h->last.mem, "Connection: keep-alive" CRLF, 24);
+    h->last.mem += 24;
+#endif
+
 /*
-    memcpy(h->last.mem, "Date: ", 6);
+    ngx_memcpy(h->last.mem, "Date: ", 6);
     h->last.mem += 6;
     h->last.mem += ngx_http_get_time(h->last.mem, time(NULL));
     *(h->last.mem++) = CR; *(h->last.mem++) = LF;
@@ -51,17 +57,20 @@ int ngx_http_header_filter(ngx_http_requ
 
     /* check */
 
-    memcpy(h->last.mem, "Server: ", 8);
+    if (r->headers_out->content_type)
+        h->last.mem += ngx_snprintf(h->last.mem, 100, "Content-Type: %s" CRLF,
+                                    r->headers_out->content_type);
+
+    ngx_memcpy(h->last.mem, "Server: ", 8);
     h->last.mem += 8;
     if (r->headers_out->server) {
         h->last.mem = ngx_cpystrn(h->last.mem, r->headers_out->server,
                                   h->end - h->last.mem);
-
         /* check space */
 
     } else {
-        ngx_memcpy(h->last.mem, NGINX_VER, sizeof(NGINX_VER));
-        h->last.mem += sizeof(NGINX_VER);
+        ngx_memcpy(h->last.mem, NGINX_VER, sizeof(NGINX_VER) - 1);
+        h->last.mem += sizeof(NGINX_VER) - 1;
     }
     *(h->last.mem++) = CR; *(h->last.mem++) = LF;