_ServerConnection

Manages a stream of requests coming into a server from a single client, dispatches those request to a back-end, and returns the responses back to the client.

actor tag _ServerConnection is
  HTTPSession tag

Implements


Constructors

create

new tag create(
  handlermaker: HandlerFactory val,
  logger: Logger val,
  conn: TCPConnection tag,
  client_ip: String val)
: _ServerConnection tag^

Parameters

Returns


Public Behaviours

dispose

Close the connection from the server end.

be dispose()

cancel

Cancel the current response. The connection has closed.

be cancel(
  msg: Payload val)

Parameters


apply

Initiate transmission of the HTTP Response message for the current Request.

be apply(
  response: Payload val)

Parameters


write

Write low level outbound raw byte stream.

be write(
  data: (String val | Array[U8 val] val))

Parameters


finish

We are done sending a response. We can close the connection if keepalive was not requested.

be finish()

throttled

TCP connection can not accept data for a while.

be throttled()

unthrottled

TCP connection can not accept data for a while.

be unthrottled()

Private Behaviours

_deliver

Dispatch requests. At the time this behavior is called for StreamTransfer and ChunkTransfer encodings, only the headers of the request may have been received. Receiving and dealing with the body, which could be quite large in POST methods, is up to the chosen application handler.

The client can send several requests without waiting for a response, but they are only passed to the back end one at a time. Only when all of the response to a processed request has been sent is the next request processed.

be _deliver(
  request: Payload val)

Parameters


_chunk

Receive some request body data, which we pass on to the handler.

be _chunk(
  data: (String val | Array[U8 val] val))

Parameters


_finish

Inidcates that the last inbound body chunk has been sent to _chunk. This is passed on to the back end.

be _finish()

_closed

be _closed()

_mute

be _mute()

_unmute

be _unmute()

Private Functions

_dispatch_pending

If we have pending requests, dispatch the next one.

fun ref _dispatch_pending()
: None val

Returns


_send

Send a single response.

fun ref _send(
  response: Payload val)
: None val

Parameters

Returns