InternalRequest in Aerys

This is a value class exposing the whole data of the clients request via public properties. It is only accessible via InternalRequest as well as HttpDriver.

Values marked with a must not be altered in order to not bring the server down.


An unique client id (unique as long as the client object is alive).


The client socket resource.


The IP address of the client.


The port of the client.


The IP address this server was accessed at.


The port the client connected to.


Whether the stream is encrypted


Only relevant if $isEncrypted == true.

Is equivalent to the stream_get_meta_data($socket)["crypto"] array.


Is a Generator returned by HttpDriver::parser().


The read watcher identifier returned by Amp\onReadable for the $socket. May be disabled or enabled to stop or resume reading from it, especially in HttpDriver.


The write watcher identifier returned by Amp\onWritable for the $socket.


The data pending to be written to the $socket. The Server will remove data from this buffer as soon as they’re written.


Size of the internal buffers, supposed to be compared against $options->softStreamCap. It is decreased by the Server upon each successful fwrite() by the amount of written bytes.


Eventually containing a Promisor when $bufferSize is exceeding $options->softStreamCap.


A callable for when the $writeBuffer will be empty again. [The Server may overwrite it.]


Boolean whether the next request will terminate the connection.


One of 0, Client::CLOSED_RD, Client::CLOSED_WR or Client::CLOSED_RDWR, where Client::CLOSED_RDWR === Client::CLOSED_RD | Client::CLOSED_WR indicating whether read or write streams are closed (or both).


Boolean whether the $export callable has been called.


Number of remaining keep-alives.


The number of responses not yet completely replied to.


The Options instance.


The HttpDriver instance used by the client.


A callable requiring the Client object as first argument. It unregisters the client from the Server and returns a callable, which, when called, decrements counters related to rate-limiting.

(Unstable, may be altered in near future)


An array of Deferreds whose Promises have been passed to InternalRequest->body. You may fail() and then unset() them.

If the $client->bodyPromisors[$internalRequest->streamId] entry exists, this means the body is still being processed.


A boolean available for use by an HttpDriver instance (to regulate parser halts and avoid resuming already active Generators).


Boolean whether the client allows push promises (HTTP/2 only).