Skip to content

Commit 6385382

Browse files
committed
Reproduce faulty write buffer behavior on Mac OS X
1 parent 1a849e7 commit 6385382

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/FunctionalInternetTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,20 @@ public function testUploadKilobyteSecure()
7878
$this->assertNotEquals('', $buffer);
7979
}
8080

81-
public function testUploadBiggerBlockSecureRequiresSmallerChunkSize()
81+
public function testUploadBiggerBlockSecure()
8282
{
83-
$size = 50 * 1000;
83+
// A few dozen kilobytes should be enough to verify this works.
84+
// Underlying buffer sizes are platform-specific, so let's increase this
85+
// a bit to trigger different behavior on Linux vs Mac OS X.
86+
$size = 136 * 1000;
87+
8488
$stream = stream_socket_client('tls://httpbin.org:443');
8589

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

0 commit comments

Comments
 (0)