From 40d5046440e20e3ec82ec6b1625f1d3cdce351a1 Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 7 Jan 2018 16:36:03 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpListenerRequest.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; } }