diff --git a/CHANGELOG.md b/CHANGELOG.md index d16d2a3..6775239 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.4.3 (2015-03-20) + +* Bugfix: Set peer name to hostname to correct security concern in PHP 5.6 (@WyyriHaximus) +* Bugfix: Always wrap secure to pull buffer due to regression in PHP +* Bugfix: SecureStream extends Stream to match documentation preventing BC (@clue) + ## 0.4.2 (2014-10-16) * Bugfix: Only toggle the stream crypto handshake once (@DaveRandom and @rdlowrey) diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php new file mode 100644 index 0000000..889a8cb --- /dev/null +++ b/tests/IntegrationTest.php @@ -0,0 +1,72 @@ +create('8.8.8.8', $loop); + + $connected = false; + $response = null; + + $connector = new Connector($loop, $dns); + $connector->create('google.com', 80) + ->then(function ($conn) use (&$connected) { + $connected = true; + $conn->write("GET / HTTP/1.0\r\n\r\n"); + return BufferedSink::createPromise($conn); + }) + ->then(function ($data) use (&$response) { + $response = $data; + }); + + $loop->run(); + + $this->assertTrue($connected); + $this->assertRegExp('#^HTTP/1\.0#', $response); + } + + /** @test */ + public function gettingEncryptedStuffFromGoogleShouldWork() + { + $loop = new StreamSelectLoop(); + + $factory = new Factory(); + $dns = $factory->create('8.8.8.8', $loop); + + $connected = false; + $response = null; + + $secureConnector = new SecureConnector( + new Connector($loop, $dns), + $loop + ); + $secureConnector->create('google.com', 443) + ->then(function ($conn) use (&$connected) { + $connected = true; + $conn->write("GET / HTTP/1.0\r\n\r\n"); + return BufferedSink::createPromise($conn); + }) + ->then(function ($data) use (&$response) { + $response = $data; + }); + + $loop->run(); + + $this->assertTrue($connected); + $this->assertRegExp('#^HTTP/1\.0#', $response); + } +}