Skip to content

Commit

Permalink
Reproduce faulty write buffer behavior on Mac OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Apr 30, 2020
1 parent 1a849e7 commit 6385382
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/FunctionalInternetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,20 @@ public function testUploadKilobyteSecure()
$this->assertNotEquals('', $buffer);
}

public function testUploadBiggerBlockSecureRequiresSmallerChunkSize()
public function testUploadBiggerBlockSecure()
{
$size = 50 * 1000;
// A few dozen kilobytes should be enough to verify this works.
// Underlying buffer sizes are platform-specific, so let's increase this
// a bit to trigger different behavior on Linux vs Mac OS X.
$size = 136 * 1000;

$stream = stream_socket_client('tls://httpbin.org:443');

// PHP < 7.1.4 (and PHP < 7.0.18) suffers from a bug when writing big
// chunks of data over TLS streams at once.
// We work around this by limiting the write chunk size to 8192 bytes
// here to also support older PHP versions.
// See https://github.com/reactphp/socket/issues/105
$loop = Factory::create();
$stream = new DuplexResourceStream(
$stream,
Expand Down

0 comments on commit 6385382

Please sign in to comment.