aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener.Portable/Net
diff options
context:
space:
mode:
Diffstat (limited to 'SocketHttpListener.Portable/Net')
-rw-r--r--SocketHttpListener.Portable/Net/HttpConnection.cs6
-rw-r--r--SocketHttpListener.Portable/Net/HttpListenerRequest.cs9
-rw-r--r--SocketHttpListener.Portable/Net/HttpListenerResponse.cs4
3 files changed, 7 insertions, 12 deletions
diff --git a/SocketHttpListener.Portable/Net/HttpConnection.cs b/SocketHttpListener.Portable/Net/HttpConnection.cs
index 67dd5c958..d9fd97ed2 100644
--- a/SocketHttpListener.Portable/Net/HttpConnection.cs
+++ b/SocketHttpListener.Portable/Net/HttpConnection.cs
@@ -204,12 +204,12 @@ namespace SocketHttpListener.Net
return i_stream;
}
- public Stream GetResponseStream(HttpListenerRequest request)
+ public Stream GetResponseStream(bool isExpect100Continue = false)
{
// TODO: can we get this stream before reading the input?
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);
}
@@ -490,7 +490,7 @@ namespace SocketHttpListener.Net
{
if (!context.Request.IsWebSocketRequest || force_close)
{
- Stream st = GetResponseStream(context.Request);
+ Stream st = GetResponseStream();
if (st != null)
st.Dispose();
diff --git a/SocketHttpListener.Portable/Net/HttpListenerRequest.cs b/SocketHttpListener.Portable/Net/HttpListenerRequest.cs
index 767f1c542..811cc6ddb 100644
--- a/SocketHttpListener.Portable/Net/HttpListenerRequest.cs
+++ b/SocketHttpListener.Portable/Net/HttpListenerRequest.cs
@@ -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");
@@ -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)
{
int p = s.IndexOf(':');
diff --git a/SocketHttpListener.Portable/Net/HttpListenerResponse.cs b/SocketHttpListener.Portable/Net/HttpListenerResponse.cs
index 8c610d725..93358cae4 100644
--- a/SocketHttpListener.Portable/Net/HttpListenerResponse.cs
+++ b/SocketHttpListener.Portable/Net/HttpListenerResponse.cs
@@ -149,7 +149,7 @@ namespace SocketHttpListener.Net
get
{
if (output_stream == null)
- output_stream = context.Connection.GetResponseStream(context.Request);
+ output_stream = context.Connection.GetResponseStream();
return output_stream;
}
}
@@ -489,7 +489,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;