Use standardised mime types and use content encoding for gzip/bzip2. I hope this will fix double gzip compression as in bug #1094649.
This commit is contained in:
@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2005-01-03 Michal Čihař <michal@cihar.com>
|
||||||
|
* export.php: Use standardised mime types and use content encoding for
|
||||||
|
gzip/bzip2. I hope this will fix double gzip compression as in bug
|
||||||
|
#1094649.
|
||||||
|
|
||||||
2005-01-01 Michal Čihař <michal@cihar.com>
|
2005-01-01 Michal Čihař <michal@cihar.com>
|
||||||
* tbl_alter.php: Don't try to set collation for non text fields (bug
|
* tbl_alter.php: Don't try to set collation for non text fields (bug
|
||||||
#1094109).
|
#1094109).
|
||||||
|
22
export.php
22
export.php
@@ -218,10 +218,10 @@ if ($asfile) {
|
|||||||
// Generate basic dump extension
|
// Generate basic dump extension
|
||||||
if ($type == 'csv') {
|
if ($type == 'csv') {
|
||||||
$filename .= '.csv';
|
$filename .= '.csv';
|
||||||
$mime_type = 'text/x-csv';
|
$mime_type = 'text/x-comma-separated-values';
|
||||||
} else if ($type == 'xls') {
|
} else if ($type == 'xls') {
|
||||||
$filename .= '.xls';
|
$filename .= '.xls';
|
||||||
$mime_type = 'application/excel';
|
$mime_type = 'application/vnd.ms-excel';
|
||||||
} else if ($type == 'xml') {
|
} else if ($type == 'xml') {
|
||||||
$filename .= '.xml';
|
$filename .= '.xml';
|
||||||
$mime_type = 'text/xml';
|
$mime_type = 'text/xml';
|
||||||
@@ -230,24 +230,21 @@ if ($asfile) {
|
|||||||
$mime_type = 'application/x-tex';
|
$mime_type = 'application/x-tex';
|
||||||
} else {
|
} else {
|
||||||
$filename .= '.sql';
|
$filename .= '.sql';
|
||||||
// loic1: 'application/octet-stream' is the registered IANA type but
|
$mime_type = 'text/x-sql';
|
||||||
// MSIE and Opera seems to prefer 'application/octetstream'
|
|
||||||
$mime_type = (PMA_USR_BROWSER_AGENT == 'IE' || PMA_USR_BROWSER_AGENT == 'OPERA')
|
|
||||||
? 'application/octetstream'
|
|
||||||
: 'application/octet-stream';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If dump is going to be compressed, set correct mime_type and add
|
// If dump is going to be compressed, set correct encoding or mime_type and add
|
||||||
// compression to extension
|
// compression to extension
|
||||||
|
$content_encoding = '';
|
||||||
if (isset($compression) && $compression == 'bzip') {
|
if (isset($compression) && $compression == 'bzip') {
|
||||||
$filename .= '.bz2';
|
$filename .= '.bz2';
|
||||||
$mime_type = 'application/x-bzip';
|
$content_encoding = 'x-bzip2';
|
||||||
} else if (isset($compression) && $compression == 'gzip') {
|
} else if (isset($compression) && $compression == 'gzip') {
|
||||||
$filename .= '.gz';
|
$filename .= '.gz';
|
||||||
$mime_type = 'application/x-gzip';
|
$content_encoding = 'x-gzip';
|
||||||
} else if (isset($compression) && $compression == 'zip') {
|
} else if (isset($compression) && $compression == 'zip') {
|
||||||
$filename .= '.zip';
|
$filename .= '.zip';
|
||||||
$mime_type = 'application/x-zip';
|
$mime_type = 'application/zip';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,6 +290,9 @@ if ($save_on_server) {
|
|||||||
if (!$save_on_server) {
|
if (!$save_on_server) {
|
||||||
if ($asfile ) {
|
if ($asfile ) {
|
||||||
// Download
|
// Download
|
||||||
|
if (!empty($content_encoding)) {
|
||||||
|
header('Content-Encoding: ' . $content_encoding);
|
||||||
|
}
|
||||||
header('Content-Type: ' . $mime_type);
|
header('Content-Type: ' . $mime_type);
|
||||||
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||||
// lem9 & loic1: IE need specific headers
|
// lem9 & loic1: IE need specific headers
|
||||||
|
Reference in New Issue
Block a user