[Modify] Polish it
This commit is contained in:
parent
ec6bfb9955
commit
9f7ee08295
@ -502,26 +502,34 @@ namespace WebSocketSharp.Net
|
||||
|
||||
public RequestStream GetRequestStream (long contentLength, bool chunked)
|
||||
{
|
||||
if (_inputStream != null || _socket == null)
|
||||
return _inputStream;
|
||||
|
||||
lock (_sync) {
|
||||
if (_socket == null)
|
||||
return _inputStream;
|
||||
|
||||
if (_inputStream != null)
|
||||
return _inputStream;
|
||||
|
||||
var buff = _requestBuffer.GetBuffer ();
|
||||
var len = (int) _requestBuffer.Length;
|
||||
disposeRequestBuffer ();
|
||||
|
||||
if (chunked) {
|
||||
_context.Response.SendChunked = true;
|
||||
_inputStream =
|
||||
new ChunkedRequestStream (_stream, buff, _position, len - _position, _context);
|
||||
}
|
||||
else {
|
||||
_inputStream =
|
||||
new RequestStream (_stream, buff, _position, len - _position, contentLength);
|
||||
_inputStream = new ChunkedRequestStream (
|
||||
_stream, buff, _position, len - _position, _context
|
||||
);
|
||||
|
||||
return _inputStream;
|
||||
}
|
||||
|
||||
_inputStream = new RequestStream (
|
||||
_stream,
|
||||
buff,
|
||||
_position,
|
||||
len - _position,
|
||||
contentLength
|
||||
);
|
||||
|
||||
return _inputStream;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user