diff options
author | Marcus Boerger <helly@php.net> | 2002-08-05 18:32:05 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2002-08-05 18:32:05 +0000 |
commit | abc7041ca2d964214585f81369e2ee36d7a7b9dc (patch) | |
tree | 8cc5329ddfda8271b9e9ca7b8e6f12df302b6005 | |
parent | dd8ec2dc0a783440108fdce5cb690473a7804da2 (diff) | |
download | php-git-abc7041ca2d964214585f81369e2ee36d7a7b9dc.tar.gz |
-keep mimetype until sapi deactivation
-move NULL check for sapi_apply_default_charset to proper position.
-rw-r--r-- | main/SAPI.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index f03b858f56..054d35dce2 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -260,16 +260,16 @@ SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC 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 @@ static void sapi_send_headers_free(TSRMLS_D) 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) @@ -374,6 +370,10 @@ SAPI_API void sapi_deactivate(TSRMLS_D) 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); } |