Documentation

RequestVerifier
in package

These are checks to ensure the client requested handshake are valid Verification rules come from section 4.2.1 of the RFC6455 document

Tags
todo

Currently just returning invalid - should consider returning appropriate HTTP status code error #s

Table of Contents

Constants

VERSION  : mixed = 13

Methods

getPermessageDeflateOptions()  : array<string|int, mixed>
verifyAll()  : bool
Given an array of the headers this method will run through all verification methods
verifyConnection()  : bool
Verify the Connection header
verifyExtensions()  : bool
verifyHost()  : bool
verifyHTTPVersion()  : bool
Test the HTTP version passed. MUST be 1.1 or greater
verifyKey()  : bool
This function verifies the nonce is valid (64 big encoded, 16 bytes random string)
verifyMethod()  : bool
Test the HTTP method. MUST be "GET"
verifyProtocol()  : bool
verifyRequestURI()  : bool
verifyUpgradeRequest()  : bool
Verify the Upgrade request to WebSockets.
verifyVersion()  : bool
Verify the version passed matches this RFC

Constants

Methods

getPermessageDeflateOptions()

public getPermessageDeflateOptions(array<string|int, mixed> $requestHeader, array<string|int, mixed> $responseHeader) : array<string|int, mixed>
Parameters
$requestHeader : array<string|int, mixed>
$responseHeader : array<string|int, mixed>
Return values
array<string|int, mixed>

verifyAll()

Given an array of the headers this method will run through all verification methods

public verifyAll(RequestInterface $request) : bool
Parameters
$request : RequestInterface
Return values
bool —

TRUE if all headers are valid, FALSE if 1 or more were invalid

verifyConnection()

Verify the Connection header

public verifyConnection(array<string|int, mixed> $connectionHeader) : bool
Parameters
$connectionHeader : array<string|int, mixed>

MUST include "Upgrade"

Return values
bool

verifyExtensions()

public verifyExtensions(mixed $val) : bool
Parameters
$val : mixed
Tags
todo

Write logic for this method. See section 4.2.1.9

Return values
bool

verifyHost()

public verifyHost(array<string|int, mixed> $hostHeader) : bool
Parameters
$hostHeader : array<string|int, mixed>
Tags
todo

Once I fix HTTP::getHeaders just verify this isn't NULL or empty...or maybe need to verify it's a valid domain??? Or should it equal $_SERVER['HOST'] ?

Return values
bool

verifyHTTPVersion()

Test the HTTP version passed. MUST be 1.1 or greater

public verifyHTTPVersion(mixed $val) : bool
Parameters
$val : mixed
Return values
bool

verifyKey()

This function verifies the nonce is valid (64 big encoded, 16 bytes random string)

public verifyKey(array<string|int, mixed> $keyHeader) : bool
Parameters
$keyHeader : array<string|int, mixed>
Tags
todo

The spec says we don't need to base64_decode - can I just check if the length is 24 and not decode?

Check the spec to see what the encoding of the key could be

Return values
bool

verifyMethod()

Test the HTTP method. MUST be "GET"

public verifyMethod(string $val) : bool
Parameters
$val : string
Return values
bool

verifyProtocol()

public verifyProtocol(mixed $val) : bool
Parameters
$val : mixed
Tags
todo

Write logic for this method. See section 4.2.1.8

Return values
bool

verifyRequestURI()

public verifyRequestURI(string $val) : bool
Parameters
$val : string
Return values
bool

verifyUpgradeRequest()

Verify the Upgrade request to WebSockets.

public verifyUpgradeRequest(array<string|int, mixed> $upgradeHeader) : bool
Parameters
$upgradeHeader : array<string|int, mixed>

MUST equal "websocket"

Return values
bool

verifyVersion()

Verify the version passed matches this RFC

public verifyVersion(array<string|int, string> $versionHeader) : bool
Parameters
$versionHeader : array<string|int, string>

MUST equal ["13"]

Return values
bool
On this page

Search results