35 lines
775 B
Markdown
35 lines
775 B
Markdown
|
|
# Text/Line Protocols
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
## Available sub-protocols
|
||
|
|
|
||
|
|
### HttpLikeProtocol
|
||
|
|
|
||
|
|
This is as the name says a HTTP-like parser. It can be used for HTTP, STOMP
|
||
|
|
and more. All messages are expected to follow the following style:
|
||
|
|
|
||
|
|
```text
|
||
|
|
query-line <$lineSeparator>
|
||
|
|
header-line* <$lineSeparator>
|
||
|
|
<$lineSeparator>
|
||
|
|
optional-body
|
||
|
|
```
|
||
|
|
|
||
|
|
Line separators default to `\n`, but can be set to any sequence or the value `true`
|
||
|
|
to attempt to automatically detect the endings used.
|
||
|
|
|
||
|
|
The presence of a body is determined by consulting the headers. The `$contentLengthHeader`
|
||
|
|
constructor parameter defaults to 'content-length', and can be set to null to disable parsing
|
||
|
|
of bodies entirely.
|
||
|
|
|
||
|
|
```php
|
||
|
|
$proto = new HttpLikeProtocol(
|
||
|
|
queryFormat: '{command} {path}',
|
||
|
|
lineSeparator: true,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
```
|