cvs: php4 /main SAPI.c

From: Date: Mon, 05 Aug 2002 18:32:05 +0000
Subject: cvs: php4 /main SAPI.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13138@lists.php.net to get a copy of this message
helly Mon Aug 5 14:32:05 2002 EDT Modified files: /php4/main SAPI.c Log: -keep mimetype until sapi deactivation -move NULL check for sapi_apply_default_charset to proper position. Index: php4/main/SAPI.c diff -u php4/main/SAPI.c:1.144 php4/main/SAPI.c:1.145 --- php4/main/SAPI.c:1.144 Sat Aug 3 10:09:56 2002 +++ php4/main/SAPI.c Mon Aug 5 14:32:05 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: SAPI.c,v 1.144 2002/08/03 14:09:56 rasmus Exp $ */ +/* $Id: SAPI.c,v 1.145 2002/08/05 18:32:05 helly Exp $ */ #include <ctype.h> #include <sys/stat.h> @@ -260,16 +260,16 @@ size_t newlen; charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET; - if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) { - newlen = len + (sizeof(";charset=")-1) + strlen(charset); - newtype = emalloc(newlen + 1); - PHP_STRLCPY(newtype, *mimetype, newlen + 1, len); - strlcat(newtype, ";charset=", newlen + 1); - if (*mimetype != NULL) { + if (*mimetype != NULL) { + if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) { + newlen = len + (sizeof(";charset=")-1) + strlen(charset); + newtype = emalloc(newlen + 1); + PHP_STRLCPY(newtype, *mimetype, newlen + 1, len); + strlcat(newtype, ";charset=", newlen + 1); efree(*mimetype); + *mimetype = newtype; + return newlen; } - *mimetype = newtype; - return newlen; } return 0; } @@ -344,10 +344,6 @@ efree(SG(sapi_headers).http_status_line); SG(sapi_headers).http_status_line = NULL; } - if (SG(sapi_headers).mimetype) { - efree(SG(sapi_headers).mimetype); - SG(sapi_headers).mimetype = NULL; - } } SAPI_API void sapi_deactivate(TSRMLS_D) @@ -373,6 +369,10 @@ } if (SG(rfc1867_uploaded_files)) { destroy_uploaded_files_hash(TSRMLS_C); + } + if (SG(sapi_headers).mimetype) { + efree(SG(sapi_headers).mimetype); + SG(sapi_headers).mimetype = NULL; } sapi_send_headers_free(TSRMLS_C); }

« previous php.cvs (#13138) next »