Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rtckit/sip",
"description": "Parser/Renderer for SIP protocol written in PHP",
"version": "0.2.3",
"version": "0.2.4",
"type": "library",
"keywords": [
"sip",
Expand Down
1 change: 1 addition & 0 deletions src/StreamParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function process(string $chunk, ?array &$messages): int
$this->buffer = ltrim(substr($this->buffer, $this->message->contentLength->value));
} else {
/* We're all set! */
$this->message->body = $this->buffer;
$this->buffer = '';
}
} else {
Expand Down
13 changes: 13 additions & 0 deletions tests/StreamParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ public function testShouldParseVariousChunkSizes()
fclose($fp);
}

public function testShouldParseStreamedMessagesNoDifferentThanPDU()
{
$bytes = file_get_contents(__DIR__ . '/fixtures/rfc4475/wsinv.dat');

if ($this->parser->process($bytes, $messages) === StreamParser::SUCCESS) {
/* Expect one message and one message only */
$this->assertEquals(1, count($messages));

/* The streamed message to be parsed as if it was an individual PDU */
$this->assertEquals(Message::parse($bytes), $messages[0]);
}
}

public function testFailureWithoutContentLength()
{
$bytes =
Expand Down