On Tue, Jun 16, 2015 at 12:37:39PM +0200, Lukas Tribus wrote:
> > Hi,
> > <?php
> > header('Content-Type: text/html;');
> 
> Thats invalid. Either:
> text/html; charset=iso-8859-1
> or
> text/html
> 
> but not with a trailing semicolon.

Content-Type is used in many places in nginx, for example in the sub module.
In the above example, the content-type is cheated.

# HG changeset patch
# User Witold Filipczyk <wite...@gazeta.pl>
# Date 1434454090 -7200
#      Tue Jun 16 13:28:10 2015 +0200
# Node ID 8ac7373110ad140bbed0b9eef3add41b769c0ba6
# Parent  cca856715722ff7f6de9e741fedd0d2759b26b74
Mark the first semicolon as the end of the Content-Type.

diff -r cca856715722 -r 8ac7373110ad src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c      Wed May 20 22:44:00 2015 +0300
+++ b/src/http/ngx_http_upstream.c      Tue Jun 16 13:28:10 2015 +0200
@@ -4568,6 +4568,7 @@
     ngx_uint_t offset)
 {
     u_char  *p, *last;
+    int semicolon = 0;
 
     r->headers_out.content_type_len = h->value.len;
     r->headers_out.content_type = h->value;
@@ -4579,7 +4580,10 @@
             continue;
         }
 
-        last = p;
+        if (!semicolon) {
+            semicolon = 1;
+            r->headers_out.content_type_len = p - h->value.data;
+        }
 
         while (*++p == ' ') { /* void */ }
 
@@ -4593,8 +4597,6 @@
 
         p += 8;
 
-        r->headers_out.content_type_len = last - h->value.data;
-
         if (*p == '"') {
             p++;
         }

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to