make frame fromBinary public, improve docs

This commit is contained in:
2024-02-27 00:21:54 +01:00
parent b706afaf67
commit 5c2279a544
5 changed files with 41 additions and 8 deletions

View File

@ -22,17 +22,33 @@ class Http2Middleware
public function __invoke(ServerRequestInterface $request, ?callable $next=null)
{
// expect upgrade h2 for secure connections, h2c for plaintext
// TODO handle HTTP/2 upgrade from HTTP/1.1
// TODO handle HTTP/2 with prior knowledge
}
/**
* Parse the settings frame present in the HTTP/1.1 upgrade request.
*
* @param string $settings
* @return SettingsFrame
*/
private function parseSettingsFromBase64String(string $settings): SettingsFrame
{
$decoded = base64_decode($settings);
$frame = new SettingsFrame();
$frame->parseFrame($decoded);
$frame->fromBinary($decoded);
return $frame;
}
/**
* Prepare a connection for the HTTP/2 session.
*
* @param ServerRequestInterface $request
* @return Http2Connection
*/
private function setupConnection(ServerRequestInterface $request): Http2Connection
{
$stream = new ThroughStream();