Struct solicit::http::server::ServerConnection [] [src]

pub struct ServerConnection<S, R, State = DefaultSessionState<DefaultStream>> where S: SendFrame, R: ReceiveFrame, State: SessionState {
    pub state: State,
    // some fields omitted
}

The struct provides a more convenient API for server-related functionality of an HTTP/2 connection, such as sending a response back to the client.

Fields

state

The state of the session associated to this client connection. Maintains the status of the connection streams.

Methods

impl<S, R, State> ServerConnection<S, R, State> where S: SendFrame, R: ReceiveFrame, State: SessionState

fn with_connection(conn: HttpConnection<S, R>, state: State) -> ServerConnection<S, R, State>

Creates a new ServerConnection that will use the given HttpConnection for its underlying HTTP/2 communication.

fn scheme(&self) -> HttpScheme

Returns the scheme of the underlying HttpConnection.

fn init(&mut self) -> HttpResult<()>

Initializes the ServerConnection by sending the server's settings and processing the client's. If the client does not provide a settings frame, returns an error.

TODO This method should eventually be split into two.

fn handle_next_frame(&mut self) -> HttpResult<()>

Fully handles the next incoming frame. Events are passed on to the internal session instance.

fn start_response(&mut self, headers: Vec<Header>, stream_id: StreamId, end_stream: EndStream) -> HttpResult<()>

Starts a response on the stream with the given ID by sending the given headers.

The body of the response is assumed to be provided by the Stream instance stored within the connection's state. (The body does not have to be ready when this method is called, as long as the Stream instance knows how to provide it to the connection later on.)

fn send_next_data(&mut self) -> HttpResult<SendStatus>

Queues a new DATA frame onto the underlying SendFrame.

Currently, no prioritization of streams is taken into account and which stream's data is queued cannot be relied on.