HTTPClient

[Source]

Manages a group of HTTP connections on behalf of a client application. A client should create one instance of this class.

class ref HTTPClient

Constructors

create

[Source]

Create the context in which all HTTP sessions will originate.

Parameters:

  • keepalivetimeoutsecs: Use TCP Keepalive and check if the other side is down every keepalive_timeout_secs seconds.
new ref create(
  auth: (AmbientAuth val | NetAuth val | TCPAuth val | 
    TCPConnectAuth val),
  sslctx: (SSLContext val | None val) = reference,
  pipeline: Bool val = true,
  keepalive_timeout_secs: U32 val = 0)
: HTTPClient ref^

Parameters

Returns


Public Functions

apply

[Source]

Schedule a request on an HTTP session. If a new connection is created, a new instance of the application's Receive Handler will be created for it. A val copy of the Payload is returned, and it can not be modified after this point. This is useful in Stream and Chunked transfer modes, so that the application can follow up with calls to Client.send_body.

fun ref apply(
  request: Payload trn,
  handlermaker: HandlerFactory val)
: Payload val ?

Parameters

Returns


dispose

[Source]

Disposes the sessions and cancels all pending requests.

fun ref dispose()
: None val

Returns


send_body

[Source]

fun ref send_body(
  data: (String val | Array[U8 val] val),
  session: HTTPSession tag)
: None val

Parameters

Returns