mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-10 07:40:34 +02:00
update response streams
This commit is contained in:
parent
102bbe2beb
commit
38c216a61a
|
@ -204,12 +204,12 @@ namespace SocketHttpListener.Net
|
||||||
return i_stream;
|
return i_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream GetResponseStream(HttpListenerRequest request)
|
public Stream GetResponseStream(bool isExpect100Continue = false)
|
||||||
{
|
{
|
||||||
// TODO: can we get this stream before reading the input?
|
// TODO: can we get this stream before reading the input?
|
||||||
if (o_stream == null)
|
if (o_stream == null)
|
||||||
{
|
{
|
||||||
if (context.Response.SendChunked || request == null || request.HasExpect100Continue)
|
if (context.Response.SendChunked || isExpect100Continue)
|
||||||
{
|
{
|
||||||
o_stream = new ResponseStream(stream, context.Response, _memoryStreamFactory, _textEncoding);
|
o_stream = new ResponseStream(stream, context.Response, _memoryStreamFactory, _textEncoding);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ namespace SocketHttpListener.Net
|
||||||
{
|
{
|
||||||
if (!context.Request.IsWebSocketRequest || force_close)
|
if (!context.Request.IsWebSocketRequest || force_close)
|
||||||
{
|
{
|
||||||
Stream st = GetResponseStream(context.Request);
|
Stream st = GetResponseStream();
|
||||||
if (st != null)
|
if (st != null)
|
||||||
st.Dispose();
|
st.Dispose();
|
||||||
|
|
||||||
|
|
|
@ -179,9 +179,9 @@ namespace SocketHttpListener.Net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasExpect100Continue)
|
if (String.Compare(Headers["Expect"], "100-continue", StringComparison.OrdinalIgnoreCase) == 0)
|
||||||
{
|
{
|
||||||
var output = (ResponseStream)context.Connection.GetResponseStream(this);
|
var output = (ResponseStream)context.Connection.GetResponseStream(true);
|
||||||
|
|
||||||
var _100continue = _textEncoding.GetASCIIEncoding().GetBytes("HTTP/1.1 100 Continue\r\n\r\n");
|
var _100continue = _textEncoding.GetASCIIEncoding().GetBytes("HTTP/1.1 100 Continue\r\n\r\n");
|
||||||
|
|
||||||
|
@ -189,11 +189,6 @@ namespace SocketHttpListener.Net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasExpect100Continue
|
|
||||||
{
|
|
||||||
get { return String.Compare(Headers["Expect"], "100-continue", StringComparison.OrdinalIgnoreCase) == 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool MaybeUri(string s)
|
static bool MaybeUri(string s)
|
||||||
{
|
{
|
||||||
int p = s.IndexOf(':');
|
int p = s.IndexOf(':');
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace SocketHttpListener.Net
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (output_stream == null)
|
if (output_stream == null)
|
||||||
output_stream = context.Connection.GetResponseStream(context.Request);
|
output_stream = context.Connection.GetResponseStream();
|
||||||
return output_stream;
|
return output_stream;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ namespace SocketHttpListener.Net
|
||||||
|
|
||||||
int preamble = encoding.GetPreamble().Length;
|
int preamble = encoding.GetPreamble().Length;
|
||||||
if (output_stream == null)
|
if (output_stream == null)
|
||||||
output_stream = context.Connection.GetResponseStream(context.Request);
|
output_stream = context.Connection.GetResponseStream();
|
||||||
|
|
||||||
/* Assumes that the ms was at position 0 */
|
/* Assumes that the ms was at position 0 */
|
||||||
ms.Position = preamble;
|
ms.Position = preamble;
|
||||||
|
|
Loading…
Reference in a new issue