mike Wed Nov 2 09:43:09 2005 EDT
Modified files: (Branch: PHP_4_4)
/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.155.2.24.2.1&r2=1.155.2.24.2.2&ty=u
Index: php-src/main/SAPI.c
diff -u php-src/main/SAPI.c:1.155.2.24.2.1 php-src/main/SAPI.c:1.155.2.24.2.2
--- php-src/main/SAPI.c:1.155.2.24.2.1 Wed Oct 19 16:36:19 2005
+++ php-src/main/SAPI.c Wed Nov 2 09:43:08 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c,v 1.155.2.24.2.1 2005/10/19 20:36:19 iliaa Exp $ */
+/* $Id: SAPI.c,v 1.155.2.24.2.2 2005/11/02 14:43:08 mike Exp $ */
#include <ctype.h>
#include <sys/stat.h>
@@ -525,6 +525,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.190.2.68.2.1&r2=1.190.2.68.2.2&ty=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.190.2.68.2.1
php-src/sapi/cgi/cgi_main.c:1.190.2.68.2.2
--- php-src/sapi/cgi/cgi_main.c:1.190.2.68.2.1 Thu Oct 6 16:39:26 2005
+++ php-src/sapi/cgi/cgi_main.c Wed Nov 2 09:43:09 2005
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.190.2.68.2.1 2005/10/06 20:39:26 johannes Exp $ */
+/* $Id: cgi_main.c,v 1.190.2.68.2.2 2005/11/02 14:43:09 mike Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -335,20 +335,12 @@
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);
+ while (h) {
+ 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