diff --git a/websocket-sharp/Net/HttpListenerRequest.cs b/websocket-sharp/Net/HttpListenerRequest.cs index 37926ee3..59b0b090 100644 --- a/websocket-sharp/Net/HttpListenerRequest.cs +++ b/websocket-sharp/Net/HttpListenerRequest.cs @@ -235,10 +235,16 @@ namespace WebSocketSharp.Net /// public Stream InputStream { get { - return _inputStream ?? - (_inputStream = HasEntityBody - ? _context.Connection.GetRequestStream (_contentLength, _chunked) - : Stream.Null); + if (!HasEntityBody) + return Stream.Null; + + if (_inputStream == null) { + _inputStream = _context.Connection.GetRequestStream ( + _contentLength, _chunked + ); + } + + return _inputStream; } }