Пример #1
0
        private async Task ProcessHttp1(HttpContext context)
        {
            var streamWriter = new StreamWriter(new MemoryStream());
            await HttpClientHandler.WriteResponse(context, streamWriter).ConfigureAwait(false);

            var bytes = ((MemoryStream)streamWriter.BaseStream).ToArray();
            await Stream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);

            if (!(context.Request.Headers.KeepAliveConnection() && context.Response.Headers.KeepAliveConnection()))
            {
                Client.Close();
            }
        }