void RenderHeaders()
        {
            var headers = head.Headers;

            bool indicateConnection;
            bool indicateConnectionClose;

            bool givenConnection      = headers.ContainsKey("Connection");
            bool givenConnectionClose = givenConnection && headers["Connection"] == "close";

            state.OnRenderHeaders(
                givenConnection,
                givenConnectionClose,
                out indicateConnection,
                out indicateConnectionClose);

            if (indicateConnection)
            {
                headers["Connection"] = indicateConnectionClose ? "close" : "keep-alive";
                if (indicateConnectionClose)
                {
                    closeConnection();
                }
            }

            renderer.Render(consumer, head);
        }
Example #2
0
 public void OnResponse(HttpResponseHead response)
 {
     renderer.Render(socket, response);
 }