Http1ClientCodec
Defined in: packages/format-http/src/h1/http1-client-codec.ts:44
The client side of an HTTP/1.x connection: encodes requests, decodes responses.
The codec remembers the method of every request it encoded, in order, because
a response cannot be framed without it — the response to HEAD declares a
length it does not send, and a 2xx to CONNECT ends HTTP on the
connection. Interim 1xx responses are decoded ahead of the final one they
precede.
After a 101 or a 2xx to CONNECT the codec decodes nothing more: the
connection carries another protocol from there on.
After a malformed or unsolicited response, decoding reports one error
carrying an Http1MessageError, then discards everything: the
connection must be dropped.
Decoding a head is O(n) time and memory in its size; the method queue is
O(r) in the requests awaiting a response.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Http1ClientCodec(
options):Http1ClientCodec
Defined in: packages/format-http/src/h1/http1-client-codec.ts:53
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Http1ClientCodec
Methods
Section titled “Methods”decode()
Section titled “decode()”decode(
view):DecodeResult<Http1ClientInbound>
Defined in: packages/format-http/src/h1/http1-client-codec.ts:57
Attempt to decode one value from the front of view.
view is a window into the driver’s buffer and is invalidated as soon as
this call returns. Copy anything retained in the returned value.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”DecodeResult<Http1ClientInbound>
Implementation of
Section titled “Implementation of”Codec.decode
encode()
Section titled “encode()”encode(
value): readonlyUint8Array<ArrayBufferLike>[]
Defined in: packages/format-http/src/h1/http1-client-codec.ts:70
Encode a value into one or more output chunks.
Returning an array defers concatenation to a vectored write, so a
length-prefixed protocol can emit [header, payload] without copying the
payload.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”readonly Uint8Array<ArrayBufferLike>[]
Implementation of
Section titled “Implementation of”Codec.encode
reset()
Section titled “reset()”reset():
void
Defined in: packages/format-http/src/h1/http1-client-codec.ts:78
Discard accumulated decode state ahead of a protocol mode switch.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Codec.reset