mike            Wed Nov  2 09:27:03 2005 EDT

  Modified files:              
    /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.205&r2=1.206&ty=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.205 php-src/main/SAPI.c:1.206
--- php-src/main/SAPI.c:1.205   Tue Nov  1 18:02:52 2005
+++ php-src/main/SAPI.c Wed Nov  2 09:27:00 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: SAPI.c,v 1.205 2005/11/01 23:02:52 iliaa Exp $ */
+/* $Id: SAPI.c,v 1.206 2005/11/02 14:27:00 mike Exp $ */
 
 #include <ctype.h>
 #include <sys/stat.h>
@@ -567,6 +567,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.268&r2=1.269&ty=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.268 php-src/sapi/cgi/cgi_main.c:1.269
--- php-src/sapi/cgi/cgi_main.c:1.268   Thu Oct  6 16:29:09 2005
+++ php-src/sapi/cgi/cgi_main.c Wed Nov  2 09:27:02 2005
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.268 2005/10/06 20:29:09 johannes Exp $ */
+/* $Id: cgi_main.c,v 1.269 2005/11/02 14:27:02 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