|
|
|
@ -30,8 +30,6 @@ namespace SocketHttpListener.Net
|
|
|
|
|
internal bool HeadersSent;
|
|
|
|
|
internal object headers_lock = new object();
|
|
|
|
|
|
|
|
|
|
bool force_close_chunked;
|
|
|
|
|
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
private readonly ITextEncoding _textEncoding;
|
|
|
|
|
|
|
|
|
@ -50,11 +48,6 @@ namespace SocketHttpListener.Net
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal bool ForceCloseChunked
|
|
|
|
|
{
|
|
|
|
|
get { return force_close_chunked; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Encoding ContentEncoding
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
@ -149,7 +142,7 @@ namespace SocketHttpListener.Net
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (output_stream == null)
|
|
|
|
|
output_stream = context.Connection.GetResponseStream(context.Request);
|
|
|
|
|
output_stream = context.Connection.GetResponseStream();
|
|
|
|
|
return output_stream;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -327,7 +320,7 @@ namespace SocketHttpListener.Net
|
|
|
|
|
headers.Add(name, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Close(bool force)
|
|
|
|
|
private void Close(bool force)
|
|
|
|
|
{
|
|
|
|
|
if (force)
|
|
|
|
|
{
|
|
|
|
@ -345,20 +338,6 @@ namespace SocketHttpListener.Net
|
|
|
|
|
Close(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Close(byte[] responseEntity, bool willBlock)
|
|
|
|
|
{
|
|
|
|
|
if (disposed)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (responseEntity == null)
|
|
|
|
|
throw new ArgumentNullException("responseEntity");
|
|
|
|
|
|
|
|
|
|
//TODO: if willBlock -> BeginWrite + Close ?
|
|
|
|
|
ContentLength64 = responseEntity.Length;
|
|
|
|
|
OutputStream.Write(responseEntity, 0, (int)content_length);
|
|
|
|
|
Close(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Redirect(string url)
|
|
|
|
|
{
|
|
|
|
|
StatusCode = 302; // Found
|
|
|
|
@ -489,7 +468,7 @@ namespace SocketHttpListener.Net
|
|
|
|
|
|
|
|
|
|
int preamble = encoding.GetPreamble().Length;
|
|
|
|
|
if (output_stream == null)
|
|
|
|
|
output_stream = context.Connection.GetResponseStream(context.Request);
|
|
|
|
|
output_stream = context.Connection.GetResponseStream();
|
|
|
|
|
|
|
|
|
|
/* Assumes that the ms was at position 0 */
|
|
|
|
|
ms.Position = preamble;
|
|
|
|
|