Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Packaging related fixes.

  • Loading branch information...
commit dfd4c0d57a62d5cd48a0df4b03482986c258a935 1 parent 1ed88fe
@boenrobot boenrobot authored
View
6 .travis.yml
@@ -7,7 +7,9 @@ php:
before_script:
- composer self-update
- composer install
- - phpunit --configuration tests/secondaryPeer.xml &
+ - composer require "pear2/cache_shm" ">=0.1.2"
+ - cd tests
+ - phpunit --configuration secondaryPeer.xml &
- sleep 2
script:
- - phpunit --configuration tests/phpunit.xml
+ - phpunit --configuration phpunit.xml
View
1  RELEASE-1.0.0a4
@@ -1,3 +1,4 @@
+* Support for encrypted connections. Note that due to known issues with PHP itself, encrypted connections may be unstable (as in "sometimes disconnect suddenly" or "sometimes hang when calling TcpClient::isDataAwaiting() without a timeout").
* Stream::isAcceptingData() and Stream::isDataAwaiting() now accept an optional timeout, modeled after stream_select().
* Changed sending to retry indefinetly unless the connection is broken, thanks to isDataAwaiting()'s new ability. Receiving can still timeout.
* Chnaged the PHAR stub to not fail when reading the hash fails.
View
23 composer.json
@@ -16,31 +16,18 @@
"wiki": "http://github.com/pear2/Net_Transmitter/wiki"
},
"require": {
- "php": ">=5.3.0",
- "pear2/cache_shm": "@dev"
+ "php": ">=5.3.0"
},
"suggest": {
+ "pear2/cache_shm": ">=0.1.2",
"ext-apc": ">=3.0.13",
- "ext-wincache": ">=1.1.0"
+ "ext-wincache": ">=1.1.0",
+ "ext-openssl": "*"
},
"autoload": {
"psr-0": {
"PEAR2\\Net\\Transmitter\\": "src/"
}
},
- "minimum-stability": "dev",
- "repositories": [
- {
- "type": "package",
- "package": {
- "name": "pear2/cache_shm",
- "version": "@dev",
- "source": {
- "type": "git",
- "url": "https://github.com/pear2/Cache_SHM.git",
- "reference": "master"
- }
- }
- }
- ]
+ "minimum-stability": "dev"
}
View
2  docs/phpdoc.dist.xml
@@ -3,7 +3,7 @@
<title>PEAR2_Net_Transmitter documentation</title>
<parser>
<default-package-name>PEAR2_Net_Transmitter</default-package-name>
- <target>PEAR2_Net_Transmitter__PhpDocumentor_Documentation</target>
+ <target>PEAR2_Net_Transmitter__PhpDocumentor_Cache</target>
<extensions>
<extension>php</extension>
</extensions>
View
1  extrasetup.php
@@ -12,6 +12,7 @@
new RecursiveDirectoryIterator(
$pkg,
RecursiveDirectoryIterator::UNIX_PATHS
+ | RecursiveDirectoryIterator::SKIP_DOTS
),
RecursiveIteratorIterator::LEAVES_ONLY
) as $path
View
28 package.xml
@@ -13,10 +13,10 @@ This package abstracts this away, so that when you want to get exactly N amount
<email>boen.robot@gmail.com</email>
<active>yes</active>
</lead>
- <date>2012-08-03</date>
- <time>04:21:01</time>
+ <date>2013-08-15</date>
+ <time>18:20:49</time>
<version>
- <release>1.0.0a3</release>
+ <release>1.0.0a4</release>
<api>1.0.0</api>
</version>
<stability>
@@ -24,10 +24,17 @@ This package abstracts this away, so that when you want to get exactly N amount
<api>alpha</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL License 2.1</license>
- <notes>Added locking support at TcpClient, particularly for persistent connections. Also some doc fixes.</notes>
+ <notes>* Support for encrypted connections. Note that due to known issues with PHP itself, encrypted connections may be unstable (as in &quot;sometimes disconnect suddenly&quot; or &quot;sometimes hang when calling TcpClient::isDataAwaiting() without a timeout&quot;).
+* Stream::isAcceptingData() and Stream::isDataAwaiting() now accept an optional timeout, modeled after stream_select().
+* Changed sending to retry indefinetly unless the connection is broken, thanks to isDataAwaiting()'s new ability. Receiving can still timeout.
+* Chnaged the PHAR stub to not fail when reading the hash fails.
+* Doc and CS fixes.</notes>
<contents>
<dir name="/">
<dir name="docs" baseinstalldir="/">
+ <file role="doc" name="apigen.neon">
+ <tasks:replace from="../src" to="php_dir" type="pear-config"/>
+ </file>
<file role="doc" name="doxygen.ini">
<tasks:replace from="../src" to="php_dir" type="pear-config"/>
<tasks:replace from="GIT: $Id$" to="version" type="package-info"/>
@@ -93,10 +100,12 @@ This package abstracts this away, so that when you want to get exactly N amount
<file role="test" name="bootstrap.php">
<tasks:replace from="../src" to="php_dir" type="pear-config"/>
</file>
+ <file role="test" name="ClientEncryptedTest.php_"/>
<file role="test" name="ClientTest.php"/>
<file role="test" name="phpunit.xml"/>
<file role="test" name="secondaryPeer.bat"/>
<file role="test" name="secondaryPeer.xml"/>
+ <file role="test" name="ServerEncryptedTest.php_"/>
<file role="test" name="ServerTest.php"/>
<file role="test" name="UnconnectedTest.php"/>
</dir>
@@ -120,25 +129,34 @@ This package abstracts this away, so that when you want to get exactly N amount
<package>
<name>PEAR2_Cache_SHM</name>
<channel>pear2.php.net</channel>
- <min>0.1.0</min>
+ <min>0.1.2</min>
</package>
+ <extension>
+ <name>openssl</name>
+ </extension>
</optional>
</dependencies>
<phprelease>
<filelist>
+ <install name="docs/apigen.neon" as="apigen.neon"/>
<install name="docs/doxygen.ini" as="doxygen.ini"/>
<install name="docs/phpdoc.dist.xml" as="phpdoc.dist.xml"/>
<install name="src/PEAR2/Net/Transmitter/Exception.php" as="PEAR2/Net/Transmitter/Exception.php"/>
+ <install name="src/PEAR2/Net/Transmitter/FilterCollection.php" as="PEAR2/Net/Transmitter/FilterCollection.php"/>
+ <install name="src/PEAR2/Net/Transmitter/LockException.php" as="PEAR2/Net/Transmitter/LockException.php"/>
<install name="src/PEAR2/Net/Transmitter/NetworkStream.php" as="PEAR2/Net/Transmitter/NetworkStream.php"/>
<install name="src/PEAR2/Net/Transmitter/SocketException.php" as="PEAR2/Net/Transmitter/SocketException.php"/>
<install name="src/PEAR2/Net/Transmitter/Stream.php" as="PEAR2/Net/Transmitter/Stream.php"/>
+ <install name="src/PEAR2/Net/Transmitter/StreamException.php" as="PEAR2/Net/Transmitter/StreamException.php"/>
<install name="src/PEAR2/Net/Transmitter/TcpClient.php" as="PEAR2/Net/Transmitter/TcpClient.php"/>
<install name="src/PEAR2/Net/Transmitter/TcpServerConnection.php" as="PEAR2/Net/Transmitter/TcpServerConnection.php"/>
<install name="tests/bootstrap.php" as="bootstrap.php"/>
+ <install name="tests/ClientEncryptedTest.php_" as="ClientEncryptedTest.php_"/>
<install name="tests/ClientTest.php" as="ClientTest.php"/>
<install name="tests/phpunit.xml" as="phpunit.xml"/>
<install name="tests/secondaryPeer.bat" as="secondaryPeer.bat"/>
<install name="tests/secondaryPeer.xml" as="secondaryPeer.xml"/>
+ <install name="tests/ServerEncryptedTest.php_" as="ServerEncryptedTest.php_"/>
<install name="tests/ServerTest.php" as="ServerTest.php"/>
<install name="tests/UnconnectedTest.php" as="UnconnectedTest.php"/>
</filelist>
View
255 packagexmlsetup.php
@@ -1,134 +1,171 @@
<?php
+use Pyrus\Developer\PackageFile\v2;
-$srcDirTask = array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => '../src',
- 'to' => 'php_dir',
- 'type' => 'pear-config'
- )
- )
- )
-);
-
-$srcFileTasks = array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => '~~summary~~',
- 'to' => 'summary',
- 'type' => 'package-info'
- )
- ),
- array(
- 'attribs' => array(
- 'from' => '~~description~~',
- 'to' => 'description',
- 'type' => 'package-info'
- )
- ),
- array(
- 'attribs' => array(
- 'from' => 'GIT: $Id$',
- 'to' => 'version',
- 'type' => 'package-info'
+$packageGen = function (
+ v2 $package,
+ v2 $compatible = null
+) {
+ $srcDirTask = array(
+ 'tasks:replace' => array(
+ array(
+ 'attribs' => array(
+ 'from' => '../src',
+ 'to' => 'php_dir',
+ 'type' => 'pear-config'
+ )
)
)
- )
-);
-
-
-$package->files['tests/bootstrap.php'] = array_merge_recursive(
- $package->files['tests/bootstrap.php']->getArrayCopy(),
- $srcDirTask
-);
-
-$package->files['docs/phpdoc.dist.xml'] = array_merge_recursive(
- $package->files['docs/phpdoc.dist.xml']->getArrayCopy(),
- $srcDirTask
-);
+ );
-$package->files['docs/doxygen.ini'] = array_merge_recursive(
- $package->files['docs/doxygen.ini']->getArrayCopy(),
- $srcDirTask,
- array(
+ $srcFileTasks = array(
'tasks:replace' => array(
array(
'attribs' => array(
+ 'from' => '~~summary~~',
+ 'to' => 'summary',
+ 'type' => 'package-info'
+ )
+ ),
+ array(
+ 'attribs' => array(
+ 'from' => '~~description~~',
+ 'to' => 'description',
+ 'type' => 'package-info'
+ )
+ ),
+ array(
+ 'attribs' => array(
'from' => 'GIT: $Id$',
'to' => 'version',
'type' => 'package-info'
)
)
)
- )
-);
+ );
+
+ $package->files['tests/bootstrap.php'] = array_merge_recursive(
+ $package->files['tests/bootstrap.php']->getArrayCopy(),
+ $srcDirTask
+ );
+
+ $package->files['docs/phpdoc.dist.xml'] = array_merge_recursive(
+ $package->files['docs/phpdoc.dist.xml']->getArrayCopy(),
+ $srcDirTask
+ );
+ $package->files['docs/apigen.neon'] = array_merge_recursive(
+ $package->files['docs/apigen.neon']->getArrayCopy(),
+ $srcDirTask
+ );
-$hasCompatible = isset($compatible);
-if ($hasCompatible) {
- $compatible->license = $package->license;
- $compatible->files[
- "test/{$package->channel}/{$package->name}/bootstrap.php"
- ] = array_merge_recursive(
- $compatible->files[
+ $package->files['docs/doxygen.ini'] = array_merge_recursive(
+ $package->files['docs/doxygen.ini']->getArrayCopy(),
+ $srcDirTask,
+ array(
+ 'tasks:replace' => array(
+ array(
+ 'attribs' => array(
+ 'from' => 'GIT: $Id$',
+ 'to' => 'version',
+ 'type' => 'package-info'
+ )
+ )
+ )
+ )
+ );
+ $hasCompatible = null !== $compatible;
+ if ($hasCompatible) {
+ $compatible->license = $package->license;
+ $compatible->files[
"test/{$package->channel}/{$package->name}/bootstrap.php"
- ]->getArrayCopy(),
- $srcDirTask
- );
+ ] = array_merge_recursive(
+ $compatible->files[
+ "test/{$package->channel}/{$package->name}/bootstrap.php"
+ ]->getArrayCopy(),
+ $srcDirTask
+ );
- $compatible->files[
- "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
- ] = array_merge_recursive(
- $compatible->files[
+ $compatible->files[
"doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
- ]->getArrayCopy(),
- $srcDirTask
- );
+ ] = array_merge_recursive(
+ $compatible->files[
+ "doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
+ ]->getArrayCopy(),
+ $srcDirTask
+ );
- $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"]
- = array_merge_recursive(
- $compatible->files[
- "doc/{$package->channel}/{$package->name}/doxygen.ini"
- ]->getArrayCopy(),
- $srcDirTask,
- array(
- 'tasks:replace' => array(
- array(
- 'attribs' => array(
- 'from' => 'GIT: $Id$',
- 'to' => 'version',
- 'type' => 'package-info'
+ $compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"]
+ = array_merge_recursive(
+ $compatible->files[
+ "doc/{$package->channel}/{$package->name}/doxygen.ini"
+ ]->getArrayCopy(),
+ $srcDirTask,
+ array(
+ 'tasks:replace' => array(
+ array(
+ 'attribs' => array(
+ 'from' => 'GIT: $Id$',
+ 'to' => 'version',
+ 'type' => 'package-info'
+ )
)
)
)
- )
- );
-}
+ );
+ }
-$oldCwd = getcwd();
-chdir(__DIR__);
-foreach (
- new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator(
- 'src',
- RecursiveDirectoryIterator::UNIX_PATHS
- ),
- RecursiveIteratorIterator::LEAVES_ONLY
- ) as $path) {
- $filename = $path->getPathname();
-
- $package->files[$filename] = array_merge_recursive(
- $package->files[$filename]->getArrayCopy(),
- $srcFileTasks
- );
-
- if ($hasCompatible) {
- $compatibleFilename = str_replace('src/', 'php/', $filename);
- $compatible->files[$compatibleFilename] = array_merge_recursive(
- $compatible->files[$compatibleFilename]->getArrayCopy(),
- $srcFileTasks
- );
+ $oldCwd = getcwd();
+ chdir(__DIR__);
+ foreach (
+ new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator(
+ 'src',
+ RecursiveDirectoryIterator::UNIX_PATHS
+ | RecursiveDirectoryIterator::SKIP_DOTS
+ ),
+ RecursiveIteratorIterator::LEAVES_ONLY
+ ) as $path) {
+ $filename = $path->getPathname();
+
+ $package->files[$filename] = array_merge_recursive(
+ $package->files[$filename]->getArrayCopy(),
+ $srcFileTasks
+ );
+
+ if ($hasCompatible) {
+ $compatibleFilename = str_replace('src/', 'php/', $filename);
+ $compatible->files[$compatibleFilename] = array_merge_recursive(
+ $compatible->files[$compatibleFilename]->getArrayCopy(),
+ $srcFileTasks
+ );
+ }
+ }
+
+ foreach (
+ new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator(
+ '.',
+ RecursiveDirectoryIterator::UNIX_PATHS
+ | RecursiveDirectoryIterator::SKIP_DOTS
+ ),
+ RecursiveIteratorIterator::LEAVES_ONLY
+ ) as $path) {
+ $filename = substr($path->getPathname(), 2);
+
+ if (isset($package->files[$filename])) {
+ $as = (strpos($filename, 'examples') === 0)
+ ? $filename
+ : substr($filename, strpos($filename, '/') + 1);
+ $package->getReleaseToInstall('php')->installAs($filename, $as);
+ }
}
+ chdir($oldCwd);
+ return array($package, $compatible);
+};
+
+list($package, $compatible) = $packageGen(
+ $package,
+ isset($compatible) ? $compatible : null
+);
+if (null === $compatible) {
+ unset($compatible);
}
-chdir($oldCwd);
View
59 stub.php
@@ -15,12 +15,12 @@
echo "\nThis package requires PHP 5.3.0 or later.";
exit(1);
}
-
+
if (extension_loaded('phar')) {
try {
$phar = new Phar(__FILE__);
$sig = $phar->getSignature();
- echo "{$sig['hash_type']} hash: {$sig['hash']}\n\n";
+ echo "{$sig['hash_type']} hash: {$sig['hash']}\n";
} catch(Exception $e) {
echo <<<HEREDOC
The PHAR extension is available, but was unable to read this PHAR file's hash.
@@ -29,7 +29,7 @@
Exception details:
HEREDOC
- . $e . "\n\n";
+ . $e . "\n";
}
} else {
echo <<<HEREDOC
@@ -40,35 +40,60 @@
HEREDOC;
}
-
+
+ echo "\n" . str_repeat('=', 80) . "\n";
+ if (extension_loaded('openssl')) {
+ echo <<<HEREDOC
+The OpenSSL extension is loaded. If you can make any connection whatsoever, you
+could also make an encrypted one.
+
+Note that due to known issues with PHP itself, encrypted connections may be
+unstable (as in "sometimes disconnect suddenly" or "sometimes hang when calling
+TcpClient::isDataAwaiting() without a timeout").
+
+HEREDOC;
+ } else {
+ echo <<<HEREDOC
+WARNING: The OpenSSL extension is not loaded.
+You can't make encrypted connections without it.
+
+HEREDOC;
+ }
+
+ echo "\n" . str_repeat('=', 80) . "\n";
if (function_exists('stream_socket_client')) {
echo <<<HEREDOC
The stream_socket_client() function is enabled.
-If you can't connect to a host, this means one
-of the following:
+If you can't connect to a host, this means one of the following:
+
1. You've mistyped the IP and/or port. Check the IP and port you've specified
-are the one you intended.
+are the ones you intended.
+
2. The host is not reachable from your web server. Try to reach the host
-from the web server by other means (e.g. ping) using the same IP, and if
-you're unable to reach it, check your network's settings.
+(!!!)from the web server(!!!) by other means (e.g. ping) using the same IP, and
+if you're unable to reach it, check the network settings on your web server,
+the remote host (if it's under your control) as well as any intermidiate nodes
+under your control that may affect the connection (e.g. routers, etc.).
+
3. Your web server is configured to forbid that outgoing connection. If you're
the web server administrator, check your firewall's settings. If you're on a
-hosting plan... Typically, shared hosts block all outgoing connections, but it's
-also possible that only connections to that port are blocked. If the remote host
-is under your control, try to connect to it on a popular port (21, 80, etc.),
-and if successful, keep using that port instead. If the connection fails even
-then, or if the remote host is not under your control, ask your host to
-configure their firewall so as to allow you to make outgoing connections to the
-ip:port you need to connect to.
+hosting plan... Typically, shared hosts block all outgoing connections, but
+it's also possible that only connections to that port are blocked. If the
+remote host is under your control, try to connect to it on a popular port (21,
+80, 443, etc.), and if successful, keep using that port instead. If the
+connection fails even then, or if the remote host is not under your control,
+ask your host to configure their firewall so as to allow you to make outgoing
+connections to the ip:port you need to connect to.
+
HEREDOC;
} else {
echo <<<HEREDOC
WARNING: stream_socket_client() is disabled. Without it, you won't be able to
connect to any host. Enable it in php.ini, or ask your host to enable it for
you.
+
HEREDOC;
}
-
}
__HALT_COMPILER();
Please sign in to comment.
Something went wrong with that request. Please try again.