class AsyncHttp1Connection
source · line 46public class AsyncHttp1Connection internal constructor(
internal val state: H1State
) : AsyncCloseable
- Supertype
AsyncCloseable
An HTTP/1 client or server over an already-established asynchronous transport. It owns transport cleanup and serializes each direction. Complete each message body before reusing that direction or transferring an upgraded transport.
function sendResponse
source · line 169public suspend fun sendResponse(head: HttpResponseHead, bytes: Array<Byte>, count: Long = bytes.size, writeIdle: Duration? = ioTimeouts.writeIdle, progress: Http1ResponseProgress? = None): Unit
Sends an immutable byte prefix through the connection's reusable output buffer. Optional progress remains readable after success or failure and excludes response-header bytes.
parameter bytes
source · line 171bytes: Array<Byte>
parameter progress
source · line 174progress: Http1ResponseProgress? = None
parameter writeIdle
source · line 173writeIdle: Duration? = ioTimeouts.writeIdle
parameter count
source · line 172count: Long = bytes.size
parameter head
source · line 170head: HttpResponseHead
function sendResponse
source · line 148public suspend fun sendResponse(head: HttpResponseHead, body: Http1BodyFraming = Http1BodyFraming.Empty, writeIdle: Duration? = ioTimeouts.writeIdle): AsyncHttp1Writer
Begins a server response with explicit body framing and returns its writer.
parameter head
source · line 149head: HttpResponseHead
parameter writeIdle
source · line 151writeIdle: Duration? = ioTimeouts.writeIdle
parameter body
source · line 150body: Http1BodyFraming = Http1BodyFraming.Empty
function receiveRequest
source · line 181public suspend fun receiveRequest(readIdle: Duration? = ioTimeouts.readIdle): Http1IncomingRequest?
Receives the next request head and body, or None at clean connection EOF.
parameter readIdle
source · line 182readIdle: Duration? = ioTimeouts.readIdle
property isReusable
source · line 119public val isReusable: Boolean
get: public read-only
Whether both message directions and protocol state currently allow another exchange on this connection.
getter get
source · line 119get(): Boolean
function receiveResponse
source · line 187public suspend fun receiveResponse(readIdle: Duration? = ioTimeouts.readIdle): Http1IncomingResponse
Receives a response associated with the previously submitted request context.
parameter readIdle
source · line 188readIdle: Duration? = ioTimeouts.readIdle
property isClosed
source · line 103public val isClosed: Boolean
get: public read-only
Whether connection cleanup has completed.
getter get
source · line 103get(): Boolean
property role
source · line 95public val role: HttpRole
get: public read-only
The local HTTP client or server role.
getter get
source · line 95get(): HttpRole
function takeTransport
source · line 198public suspend fun takeTransport(): HttpTransport
Transfers ownership after a completed protocol-switch boundary, preserving all already-read suffix bytes.
property ioTimeouts
source · line 99public val ioTimeouts: HttpIoTimeoutOptions
get: public read-only
The default I/O idle deadlines used by this connection.
getter get
source · line 99get(): HttpIoTimeoutOptions
function sendResponse
source · line 157public suspend fun sendResponse(head: HttpResponseHead, buffer: NativeByteBuffer, count: Long = buffer.readableBytes, writeIdle: Duration? = ioTimeouts.writeIdle): Unit
Sends and completes a response with an already-buffered body. The source cursor records actual body progress, including a prefix accepted before failure.
parameter head
source · line 158head: HttpResponseHead
parameter count
source · line 160count: Long = buffer.readableBytes
parameter writeIdle
source · line 161writeIdle: Duration? = ioTimeouts.writeIdle
parameter buffer
source · line 159buffer: NativeByteBuffer
function sendRequest
source · line 140public suspend fun sendRequest(head: HttpRequestHead, body: Http1BodyFraming = Http1BodyFraming.Empty, writeIdle: Duration? = ioTimeouts.writeIdle): AsyncHttp1Writer
Begins a client request with explicit body framing and returns its writer. Finish the writer even for an empty body.
parameter head
source · line 141head: HttpRequestHead
parameter writeIdle
source · line 143writeIdle: Duration? = ioTimeouts.writeIdle
parameter body
source · line 142body: Http1BodyFraming = Http1BodyFraming.Empty
property pendingResponseFirstByteAt
source · line 108public val pendingResponseFirstByteAt: TimeMark?
get: public read-only
The captured first-byte time of the pending response, when timing collection is enabled and input has arrived.
getter get
source · line 108get(): Option<TimeMark>
function close
source · line 202public override suspend fun close(): Unit
- Overrides
close
Closes the connection and waits for owned transport I/O and cleanup.