mike            Wed Nov  2 09:38:13 2005 EDT

  Modified files:              (Branch: PHP_5_1)
    /php-src/main       SAPI.c 
    /php-src/sapi/cgi   cgi_main.c 
  Log:
  - sapi_header_op(SAPI_HEADER_(REPLACE|ADD), {NULL, 0, 0}) caused HTTP 
response splitting
  - sapi_send_headers() already takes care of default_content_type (left over 
of fix for bug #29983)
  
http://cvs.php.net/diff.php/php-src/main/SAPI.c?r1=1.202.2.2&r2=1.202.2.3&ty=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.202.2.2 php-src/main/SAPI.c:1.202.2.3
--- php-src/main/SAPI.c:1.202.2.2       Tue Nov  1 17:59:18 2005
+++ php-src/main/SAPI.c Wed Nov  2 09:38:10 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: SAPI.c,v 1.202.2.2 2005/11/01 22:59:18 iliaa Exp $ */
+/* $Id: SAPI.c,v 1.202.2.3 2005/11/02 14:38:10 mike Exp $ */
 
 #include <ctype.h>
 #include <sys/stat.h>
@@ -545,6 +545,10 @@
        case SAPI_HEADER_REPLACE:
        case SAPI_HEADER_ADD: {
                sapi_header_line *p = arg;
+               
+               if (!p->line || !p->line_len) {
+                       return FAILURE;
+               }
                header_line = p->line;
                header_line_len = p->line_len;
                http_response_code = p->response_code;
http://cvs.php.net/diff.php/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.1&r2=1.267.2.2&ty=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.1 
php-src/sapi/cgi/cgi_main.c:1.267.2.2
--- php-src/sapi/cgi/cgi_main.c:1.267.2.1       Thu Oct  6 16:29:40 2005
+++ php-src/sapi/cgi/cgi_main.c Wed Nov  2 09:38:13 2005
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.1 2005/10/06 20:29:40 johannes Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.2 2005/11/02 14:38:13 mike Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -331,21 +331,13 @@
                PHPWRITE_H(buf, len);
        }
 
-       if (SG(sapi_headers).send_default_content_type)
-       {
-               char *hd;
-
-               hd = sapi_get_default_content_type(TSRMLS_C);
-               PHPWRITE_H("Content-type: ", sizeof("Content-type: ") - 1);
-               PHPWRITE_H(hd, strlen(hd));
-               PHPWRITE_H("\r\n", 2);
-               efree(hd);
-       }
-
        h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
        while (h) {
-               PHPWRITE_H(h->header, h->header_len);
-               PHPWRITE_H("\r\n", 2);
+               /* prevent CRLFCRLF */
+               if (h->header_len) {
+                       PHPWRITE_H(h->header, h->header_len);
+                       PHPWRITE_H("\r\n", 2);
+               }
                h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
        }
        PHPWRITE_H("\r\n", 2);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to