using System; using System.IO; using System.Net; using System.Text; namespace EmbedIO.Net.Internal { /// /// Represents a wrapper for HttpListenerContext.Response. /// /// public class SystemHttpResponse : IHttpResponse { private readonly System.Net.HttpListenerResponse _response; /// /// Initializes a new instance of the class. /// /// The context. public SystemHttpResponse(System.Net.HttpListenerContext context) { _response = context.Response; Cookies = new SystemCookieCollection(_response.Cookies); } /// public WebHeaderCollection Headers => _response.Headers; /// public int StatusCode { get => _response.StatusCode; set => _response.StatusCode = value; } /// public long ContentLength64 { get => _response.ContentLength64; set => _response.ContentLength64 = value; } /// public string ContentType { get => _response.ContentType; set => _response.ContentType = value; } /// public Stream OutputStream => _response.OutputStream; /// public ICookieCollection Cookies { get; } /// public Encoding? ContentEncoding { get => _response.ContentEncoding; set => _response.ContentEncoding = value; } /// public bool KeepAlive { get => _response.KeepAlive; set => _response.KeepAlive = value; } /// public bool SendChunked { get => _response.SendChunked; set => _response.SendChunked = value; } /// public Version ProtocolVersion { get => _response.ProtocolVersion; set => _response.ProtocolVersion = value; } /// public string StatusDescription { get => _response.StatusDescription; set => _response.StatusDescription = value; } /// public void SetCookie(Cookie cookie) => _response.SetCookie(cookie); /// public void Close() => _response.OutputStream?.Dispose(); } }