HTTPClient

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

new ref create(
  auth: (AmbientAuth val | NetAuth val | TCPAuth val | 
    TCPConnectAuth val),
  sslctx: (SSLContext val | None val) = seq,
  pipeline: Bool val = seq)
: HTTPClient ref^

Parameters

Returns


Public Functions

apply

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


send_body

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

Parameters

Returns


Private Functions

_get_session

Gets or creates an HTTP Session for the given URL. If a new session is created, a new Receive Handler instance is created too.

fun ref _get_session(
  url: URL val,
  handlermaker: HandlerFactory val)
: _ClientConnection tag ?

Parameters

Returns