HttpReader Type
Constructors
| Constructor | Description |
Full Usage:
HttpReader(transport, pipe, cancellationToken)
Parameters:
ITransport
pipe : Pipe
cancellationToken : CancellationToken
Returns: HttpReader
|
|
Instance members
| Instance member | Description |
Full Usage:
this.cancelPendingReads ()
|
|
Full Usage:
this.init ()
|
|
Full Usage:
this.isDirty
Returns: bool
|
|
|
Read all headers from the stream, returning a list of (name, value) pairs. Names are returned lowercase. Optimized to avoid the per-header string allocations performed by the previous string-based parser: - Reads each header line directly into the byte buffer (no UTF8.GetString of the whole line). - Uses byte-span scanning for ':' and whitespace trimming. - Returns interned lowercase strings for well-known header names (zero allocation for name). - For unknown names, lowercases ASCII in a scratch buffer and allocates exactly one string. - Allocates exactly one string for the value. |
|
|
|
|
|
|
Full Usage:
this.readPostData bytes select
Parameters:
int
select : ReadOnlyMemory<byte> -> int -> unit
Returns: Task<unit>
|
|
|
Read the HTTP request line directly from the byte buffer and decompose it into (method, path, rawQuery, version). Allocation profile vs. the previous `readLine` + `parseUrl` pipeline: - method: 0 allocations on the common path (interned via `KnownMethods.tryMatch`) - version: 0 allocations on the common path (interned via `KnownVersions.tryMatch`) - path: 1 string allocation (sliced directly from `readLineBuffer`) - rawQuery: 1 string allocation only when '?' is present, otherwise `String.Empty` Previously the same data cost: 1 full-line UTF-8 string + 4 `Substring` allocations.
|
Full Usage:
this.readUntilPattern marker select
Parameters:
byte[]
select : SelectFunction
Returns: SocketOp<int64>
|
Read the passed stream into buff until the marker (e.g. CRLF) is reached and returns the number of bytes consumed before the marker. This is now a thin adapter over `scanMarker`: since `scanMarker` no longer returns `NeedMore` to its caller (the internal async fallback pumps until the scan is terminal), we just translate `ScanResult` into an `int64`. When `scanMarker` completes synchronously \u2014 the common case for HTTP/1.1 keep-alive where the next request's headers arrive in a single `recv()` \u2014 the entire `readUntilPattern` call also completes synchronously without allocating a state-machine box.
|
Full Usage:
this.scanMarker marker select
Parameters:
byte[]
select : SelectFunction
Returns: ValueTask<Result<ScanResult, Error>>
|
Iterates over a BufferSegment list looking for a marker, data before the marker is sent to the function select. Returns synchronously when the marker is already present in the buffered data \u2014 the common case for HTTP/1.1 keep-alive where the next request's headers typically arrive in a single recv().
|
|
|
Full Usage:
this.stop ()
|