|
|
@ -16,38 +16,28 @@ namespace Emby.Server.Implementations.SocketSharp
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly HttpResponse _response;
|
|
|
|
public WebSocketSharpResponse(ILogger logger, HttpResponse response)
|
|
|
|
|
|
|
|
|
|
|
|
public WebSocketSharpResponse(ILogger logger, HttpResponse response, IRequest request)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
this._response = response;
|
|
|
|
OriginalResponse = response;
|
|
|
|
Items = new Dictionary<string, object>();
|
|
|
|
|
|
|
|
Request = request;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IRequest Request { get; private set; }
|
|
|
|
public HttpResponse OriginalResponse { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, object> Items { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public object OriginalResponse => _response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int StatusCode
|
|
|
|
public int StatusCode
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => this._response.StatusCode;
|
|
|
|
get => OriginalResponse.StatusCode;
|
|
|
|
set => this._response.StatusCode = value;
|
|
|
|
set => OriginalResponse.StatusCode = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string StatusDescription { get; set; }
|
|
|
|
public string StatusDescription { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string ContentType
|
|
|
|
public string ContentType
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => _response.ContentType;
|
|
|
|
get => OriginalResponse.ContentType;
|
|
|
|
set => _response.ContentType = value;
|
|
|
|
set => OriginalResponse.ContentType = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IHeaderDictionary Headers => _response.Headers;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void AddHeader(string name, string value)
|
|
|
|
public void AddHeader(string name, string value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.Equals(name, "Content-Type", StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (string.Equals(name, "Content-Type", StringComparison.OrdinalIgnoreCase))
|
|
|
@ -56,22 +46,15 @@ namespace Emby.Server.Implementations.SocketSharp
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_response.Headers.Add(name, value);
|
|
|
|
OriginalResponse.Headers.Add(name, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string GetHeader(string name)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return _response.Headers[name];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Redirect(string url)
|
|
|
|
public void Redirect(string url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_response.Redirect(url);
|
|
|
|
OriginalResponse.Redirect(url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Stream OutputStream => _response.Body;
|
|
|
|
public Stream OutputStream => OriginalResponse.Body;
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsClosed { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool SendChunked { get; set; }
|
|
|
|
public bool SendChunked { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|