Skip to content

Commit 00bf8ee

Browse files
i-peppaadoy
authored andcommitted
Fix client when payload is > 65535 bytes
1 parent 2554226 commit 00bf8ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Adoy/FastCGI/Client.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class Client
7070
const REQ_STATE_ERR = 3;
7171
const REQ_STATE_TIMED_OUT = 4;
7272

73+
const FCGI_MAX_LENGTH = 0xffff;
74+
7375
/**
7476
* Socket
7577
* @var Resource
@@ -475,6 +477,11 @@ public function async_request(array $params, $stdin)
475477
$request .= $this->buildPacket(self::PARAMS, '', $id);
476478

477479
if ($stdin) {
480+
while (strlen($stdin) > self::FCGI_MAX_LENGTH) {
481+
$chunkStdin = substr($stdin, 0, self::FCGI_MAX_LENGTH);
482+
$request .= $this->buildPacket(self::STDIN, $chunkStdin, $id);
483+
$stdin = substr($stdin, self::FCGI_MAX_LENGTH);
484+
}
478485
$request .= $this->buildPacket(self::STDIN, $stdin, $id);
479486
}
480487
$request .= $this->buildPacket(self::STDIN, '', $id);

0 commit comments

Comments
 (0)