flare_mlake · API · http

flare.http.request_body

A request body that keeps arriving after the handler has started.

With Http3Config.stream_request_bodies an HTTP/3 request is handed to the handler on its HEADERS; the HTTP/3 driver appends the body to a shared :class:BodyPipe as DATA arrives, and the handler reads it with :meth:flare.http.Request.body_stream, a :trait:ChunkSource it can put on its response (echo, transform, proxy) without blocking the loop.

Structs

BodyPipe

struct BodyPipe

Implements Movable

Fields
data: List[UInt8]: Body bytes received and not yet read.
done: Bool: The request ended (FIN) and everything is in :attr:data.
failed: Bool: The request stream was reset or abandoned.

__init__

def __init__(out self, var data: List[UInt8], done: Bool)

BodyPipeSource

struct BodyPipeSource

Reads a :class:BodyPipe: data as it arrives, an empty chunk while there is none yet, None once the body has ended.

Implements ChunkSource, Movable

Fields
pipe: ArcPointer[BodyPipe]

__init__

def __init__(out self, pipe: ArcPointer[BodyPipe])

next

def next(mut self, cancel: Cancel) -> Optional[List[UInt8]]