Documentation

Hale.Http2.Network.HTTP2.Server

Mutable state for an HTTP/2 connection.

  • localSettings : Settings

    Local settings (what we advertise).

  • peerSettings : Settings

    Remote peer's settings.

  • peerSettingsReceived : Bool

    Whether we have received the peer's initial SETTINGS.

  • streams : StreamTable

    Stream table.

  • flowControl : ConnectionFlowControl

    Connection-level flow control.

  • decoderTable : HPACK.DynamicTable

    HPACK decoder dynamic table.

  • encoderTable : HPACK.DynamicTable

    HPACK encoder dynamic table.

  • headerBlockState : HeaderBlockState

    Header block assembly state.

  • goawayReceived : Bool

    Whether a GOAWAY has been sent or received.

  • lastGoodStreamId : StreamId

    Last stream ID we will process (set when sending GOAWAY).

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Create initial connection state with default settings.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Network.HTTP2.sendGoaway (send : ByteArrayIO Unit) (lastStreamId : StreamId) (errorCode : ErrorCode) (msg : String := "") :

        Send a GOAWAY frame with the given error code and close the connection. $$\text{sendGoaway} : (\text{ByteArray} \to \text{IO Unit}) \to \text{StreamId} \to \text{ErrorCode} \to \text{String} \to \text{IO Unit}$$

        Equations
        Instances For
          def Network.HTTP2.sendRstStream (send : ByteArrayIO Unit) (streamId : StreamId) (errorCode : ErrorCode) :

          Send a RST_STREAM frame for a specific stream. $$\text{sendRstStream} : (\text{ByteArray} \to \text{IO Unit}) \to \text{StreamId} \to \text{ErrorCode} \to \text{IO Unit}$$

          Equations
          Instances For

            Process a received SETTINGS frame (non-ACK). Updates the peer settings and sends an ACK.

            $$\text{processSettings} : \text{ConnectionState} \to \text{ByteArray} \to (\text{ByteArray} \to \text{IO Unit}) \to \text{IO}(\text{Except}(\text{ConnectionError}, \text{ConnectionState}))$$

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Process a received PING frame. Echo back with ACK flag. $$\text{processPing} : \text{ByteArray} \to (\text{ByteArray} \to \text{IO Unit}) \to \text{IO Unit}$$

              Equations
              Instances For

                Process a received WINDOW_UPDATE frame. $$\text{processWindowUpdate} : \text{ConnectionState} \to \text{FrameHeader} \to \text{ByteArray} \to \text{Except}(\text{ConnectionError} \oplus \text{StreamError}, \text{ConnectionState})$$

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Network.HTTP2.sendResponse (state : ConnectionState) (send : ByteArrayIO Unit) (streamId : StreamId) (headers : List (String × String)) (body : ByteArray) :

                  Send a response: encode headers with HPACK, split into HEADERS + CONTINUATION frames if needed, then send DATA frame with the body.

                  $$\text{sendResponse} : \text{ConnectionState} \to (\text{ByteArray} \to \text{IO Unit}) \to \text{StreamId} \to \text{List}(\text{HeaderField}) \to \text{ByteArray} \to \text{IO}(\text{ConnectionState})$$

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def Network.HTTP2.sendResponse.sendCont (send : ByteArrayIO Unit) (streamId : StreamId) (remaining : List ByteArray) :
                    Equations
                    Instances For

                      Run an HTTP/2 connection as a server.

                      Takes IO callbacks for reading and writing bytes, plus a request handler that receives decoded headers and a stream ID and returns response headers and a body.

                      $$\text{runHTTP2Connection} : \text{IO ByteArray} \to (\text{ByteArray} \to \text{IO Unit}) \to (\text{List}(\text{String} \times \text{String}) \to \text{StreamId} \to \text{IO}(\text{List}(\text{String} \times \text{String}) \times \text{ByteArray})) \to \text{IO}(\text{Except}(\text{ConnectionError}, \text{Unit}))$$

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For