Http module

close

procedure · 2 overloadsSource

Closes the connection: both halves share one socket or pipe end, so closing the reader closes it once. With now it does not wait (see Io.close).

close :: (link: Link, now := false) -> Io.Io_Error

Closes the connection: both halves share one socket or pipe end, so closing the reader closes it once. With now it does not wait (see Io.close).

Parameters

link: Link
now := false

Returns

close :: (response: *Client_Response, now := false)

Releases a response: its connection and its memory. If the body was read to the end the connection is already back in the pool. Otherwise a short rest of the body is read and thrown away so the connection can serve the next request, and a connection with more left, or one that fails while draining, is closed. With now = true nothing is drained: the connection is closed at once, for code that cannot wait. Safe to call at any time and more than once (it leaves response empty), so defer close(*response) is always right. After it the body cannot be read.

Parameters

response: *Client_Response
now := false

See also