Skip to content

Commit

Permalink
Merge pull request #250 from owncloud/bump-zipstreamer
Browse files Browse the repository at this point in the history
Bump ZipStreamer to 1.0
  • Loading branch information
DeepDiver1975 committed Feb 18, 2016
2 parents b65fc86 + 0a74a75 commit fc0c115
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 67 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"require": {
"doctrine/dbal": "2.5.2",
"mcnetic/zipstreamer": "v0.7",
"mcnetic/zipstreamer": "^1.0",
"phpseclib/phpseclib": "2.0.0",
"rackspace/php-opencloud": "v1.9.2",
"james-heinrich/getid3": "dev-master",
Expand Down
19 changes: 12 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 54 additions & 49 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,55 +742,6 @@
"exception"
]
},
{
"name": "mcnetic/zipstreamer",
"version": "v0.7",
"version_normalized": "0.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/McNetic/PHPZipStreamer.git",
"reference": "44c99c659abf4dac92882437c1da68de824ca9d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/McNetic/PHPZipStreamer/zipball/44c99c659abf4dac92882437c1da68de824ca9d0",
"reference": "44c99c659abf4dac92882437c1da68de824ca9d0",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2015-08-26 13:48:01",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"ZipStreamer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0+"
],
"authors": [
{
"name": "Nicolai Ehemann",
"email": "en@enlightened.de",
"role": "Author/Maintainer"
},
{
"name": "André Rothe",
"email": "arothe@zks.uni-leipzig.de",
"role": "Contributor"
}
],
"description": "Stream zip files without i/o overhead",
"homepage": "https://github.com/McNetic/PHPZipStreamer",
"keywords": [
"stream",
"zip"
]
},
{
"name": "doctrine/annotations",
"version": "v1.2.7",
Expand Down Expand Up @@ -3237,5 +3188,59 @@
"utf-8",
"utf8"
]
},
{
"name": "mcnetic/zipstreamer",
"version": "v1.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/McNetic/PHPZipStreamer.git",
"reference": "e57c198486242476587d04844084adbe8330581d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/McNetic/PHPZipStreamer/zipball/e57c198486242476587d04844084adbe8330581d",
"reference": "e57c198486242476587d04844084adbe8330581d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2016-02-17 22:47:09",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"ZipStreamer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0+"
],
"authors": [
{
"name": "Nicolai Ehemann",
"email": "en@enlightened.de",
"role": "Author/Maintainer"
},
{
"name": "André Rothe",
"email": "arothe@zks.uni-leipzig.de",
"role": "Contributor"
},
{
"name": "Lukas Reschke",
"email": "lukas@owncloud.com",
"role": "Contributor"
}
],
"description": "Stream zip files without i/o overhead",
"homepage": "https://github.com/McNetic/PHPZipStreamer",
"keywords": [
"stream",
"zip"
]
}
]
4 changes: 3 additions & 1 deletion mcnetic/zipstreamer/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ Characteristics
streams, if they are created from disk), has low cpu usage (especially when
not compressing) and a low memory footprint, as the streams are read in small
chunks
* **Compatibility issues:** ZipStreamer by default uses the Zip64 extension. Some
* **Compatibility issues:** ZipStreamer produces 'streamed' zip files (part of
the zip standard since 1993). Some (mostly older) zip tools and Mac OS X finder
can not handle that. ZipStreamer by default uses the Zip64 extension. Some
(mostly older) zip tools and Mac OS X can not handle that, therefore it can be
disabled (see below)
* **Large output files:** With the Zip64 extension, ZipStreamer can handle
Expand Down
6 changes: 4 additions & 2 deletions mcnetic/zipstreamer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ PHPZipStreamer
Simple Class to create zip files on the fly and stream directly to the HTTP
client as the content is added (without using temporary files).

Copyright (C) 2013-2015 Nicolai Ehemann (en@enlightened.de) and contributors
Copyright (C) 2013-2016 Nicolai Ehemann (en@enlightened.de) and contributors

Contributors:
Contributors (in order of first contribution):
* André Rothe (arothe@zks.uni-leipzig.de)
* Lukas Reschke (lukas@owncloud.com)
* Others (who do not want to be mentioned)

See MANUAL.md for a short intro to using ZipStreamer.

Expand Down
8 changes: 6 additions & 2 deletions mcnetic/zipstreamer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
},{
"name": "André Rothe",
"email": "arothe@zks.uni-leipzig.de",
"role": "Contributor"
}
"role": "Contributor"
},{
"name": "Lukas Reschke",
"email": "lukas@owncloud.com",
"role": "Contributor"
}
],
"repositories": [ {
"type": "vcs",
Expand Down
15 changes: 10 additions & 5 deletions mcnetic/zipstreamer/src/ZipStreamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author André Rothe <arothe@zks.uni-leipzig.de>
* @copyright Copyright (C) 2013-2015 Nicolai Ehemann and contributors
* @license GNU GPL
* @version 0.7
* @version 1.0
*/
namespace ZipStreamer;

Expand All @@ -46,7 +46,7 @@ class COMPR {
}

class ZipStreamer {
const VERSION = "0.7";
const VERSION = "1.0";

const ZIP_LOCAL_FILE_HEADER = 0x04034b50; // local file header signature
const ZIP_CENTRAL_FILE_HEADER = 0x02014b50; // central file header signature
Expand Down Expand Up @@ -166,7 +166,13 @@ public function sendHeaders($archiveName = 'archive.zip', $contentType = 'applic
header('Accept-Ranges: bytes');
header('Connection: Keep-Alive');
header('Content-Type: ' . $contentType);
header('Content-Disposition: attachment; filename="' . $archiveName . '";');
// Use UTF-8 filenames when not using Internet Explorer
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') > 0) {
header('Content-Disposition: attachment; filename="' . rawurlencode($archiveName) . '"' );
} else {
header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode($archiveName)
. '; filename="' . rawurlencode($archiveName) . '"' );
}
header('Content-Transfer-Encoding: binary');
}
}
Expand Down Expand Up @@ -359,8 +365,7 @@ private function streamFileData($stream, $compress, $level) {
$compStream = DeflateStream::create($level);
}

while (!feof($stream)) {
$data = fread($stream, self::STREAM_CHUNK_SIZE);
while (!feof($stream) && $data = fread($stream, self::STREAM_CHUNK_SIZE)) {
$dataLength->add(strlen($data));
hash_update($hashCtx, $data);
if (COMPR::DEFLATE === $compress) {
Expand Down

0 comments on commit fc0c115

Please sign in to comment.