Skip to content

Commit

Permalink
Merge pull request #278 from owncloud/streams-0.4.1
Browse files Browse the repository at this point in the history
update icewind/streams to 0.4.1
  • Loading branch information
Vincent Petry committed Jun 16, 2016
2 parents 12f9071 + 071300a commit 509385e
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 62 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"pimple/pimple": "3.0.2",
"ircmaxell/password-compat": "1.0.*",
"nikic/php-parser": "1.4.1",
"icewind/Streams": "0.4.0",
"icewind/Streams": "0.4.1",
"swiftmailer/swiftmailer": "@stable",
"guzzlehttp/guzzle": "5.3.0",
"league/flysystem": "1.0.20",
Expand Down
20 changes: 12 additions & 8 deletions composer.lock

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

2 changes: 1 addition & 1 deletion composer/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Copyright (c) 2016 Nils Adermann, Jordi Boggiano

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
100 changes: 52 additions & 48 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"common",
"event",
"exception"
]
],
"abandoned": "guzzle/guzzle"
},
{
"name": "guzzle/stream",
Expand Down Expand Up @@ -98,7 +99,8 @@
"Guzzle",
"component",
"stream"
]
],
"abandoned": "guzzle/guzzle"
},
{
"name": "guzzle/parser",
Expand Down Expand Up @@ -144,7 +146,8 @@
"http",
"message",
"url"
]
],
"abandoned": "guzzle/guzzle"
},
{
"name": "guzzle/http",
Expand Down Expand Up @@ -203,7 +206,8 @@
"curl",
"http",
"http client"
]
],
"abandoned": "guzzle/guzzle"
},
{
"name": "rackspace/php-opencloud",
Expand Down Expand Up @@ -307,7 +311,7 @@
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/natxet/CssMin/zipball/0b2170454eed9024c7e26b036fbccf2d7f6f2c53",
"url": "https://api.github.com/repos/natxet/CssMin/zipball/003920e783c568c2d8fdf03999eebefb8479092a",
"reference": "003920e783c568c2d8fdf03999eebefb8479092a",
"shasum": ""
},
Expand Down Expand Up @@ -2503,49 +2507,6 @@
"xml"
]
},
{
"name": "icewind/streams",
"version": "0.4.0",
"version_normalized": "0.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/Streams.git",
"reference": "9ca40274645a967ecc3408b0ca2e6255ead1d1d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/9ca40274645a967ecc3408b0ca2e6255ead1d1d3",
"reference": "9ca40274645a967ecc3408b0ca2e6255ead1d1d3",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2016-03-17 12:32:25",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Icewind\\Streams\\Tests\\": "tests/",
"Icewind\\Streams\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Robin Appelman",
"email": "icewind@owncloud.com"
}
],
"description": "A set of generic stream wrappers"
},
{
"name": "symfony/event-dispatcher",
"version": "v2.8.3",
Expand Down Expand Up @@ -3142,5 +3103,48 @@
"javascript",
"minification"
]
},
{
"name": "icewind/streams",
"version": "0.4.1",
"version_normalized": "0.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/Streams.git",
"reference": "d3620e8dc410c86c2ba55579803679c4e0b289ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/d3620e8dc410c86c2ba55579803679c4e0b289ac",
"reference": "d3620e8dc410c86c2ba55579803679c4e0b289ac",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2016-06-02 14:37:52",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Icewind\\Streams\\Tests\\": "tests/",
"Icewind\\Streams\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Robin Appelman",
"email": "icewind@owncloud.com"
}
],
"description": "A set of generic stream wrappers"
}
]
10 changes: 6 additions & 4 deletions icewind/streams/src/RetryWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function stream_read($count) {
$result = parent::stream_read($count);

$bytesReceived = strlen($result);
while ($bytesReceived < $count && !$this->stream_eof()) {
while (strlen($result) > 0 && $bytesReceived < $count && !$this->stream_eof()) {
$result .= parent::stream_read($count - $bytesReceived);
$bytesReceived = strlen($result);
}
Expand All @@ -54,11 +54,13 @@ public function stream_read($count) {

public function stream_write($data) {
$bytesToSend = strlen($data);
$result = parent::stream_write($data);
$bytesWritten = parent::stream_write($data);
$result = $bytesWritten;

while ($result < $bytesToSend && !$this->stream_eof()) {
while ($bytesWritten > 0 && $result < $bytesToSend && !$this->stream_eof()) {
$dataLeft = substr($data, $result);
$result += parent::stream_write($dataLeft);
$bytesWritten = parent::stream_write($dataLeft);
$result += $bytesWritten;
}

return $result;
Expand Down

0 comments on commit 509385e

Please sign in to comment.