Example #1
0
        public RequestStream GetRequestStream(long contentLength, bool chunked)
        {
            RequestStream requestStream;

            if ((this._inputStream != null ? false : this._socket != null))
            {
                object obj = this._sync;
                Monitor.Enter(obj);
                try
                {
                    if (this._socket != null)
                    {
                        byte[] buffer = this._requestBuffer.GetBuffer();
                        int    length = (int)this._requestBuffer.Length;
                        this.disposeRequestBuffer();
                        if (!chunked)
                        {
                            this._inputStream = new RequestStream(this._stream, buffer, this._position, length - this._position, contentLength);
                        }
                        else
                        {
                            this._context.Response.SendChunked = true;
                            this._inputStream = new ChunkedRequestStream(this._stream, buffer, this._position, length - this._position, this._context);
                        }
                        requestStream = this._inputStream;
                    }
                    else
                    {
                        requestStream = this._inputStream;
                    }
                }
                finally
                {
                    Monitor.Exit(obj);
                }
            }
            else
            {
                requestStream = this._inputStream;
            }
            return(requestStream);
        }
Example #2
0
 public RequestStream GetRequestStream(bool chunked, long contentlength)
 {
     if (this._inputStream == null)
     {
         byte[] buffer = this._requestBuffer.GetBuffer();
         int    num    = buffer.Length;
         this._requestBuffer = null;
         if (chunked)
         {
             this._chunked = true;
             this._context.Response.SendChunked = true;
             this._inputStream = new ChunkedInputStream(this._context, this._stream, buffer, this._position, num - this._position);
         }
         else
         {
             this._inputStream = new RequestStream(this._stream, buffer, this._position, num - this._position, contentlength);
         }
     }
     return(this._inputStream);
 }
Example #3
0
 public RequestStream GetRequestStream(bool chunked, long contentlength)
 {
     if (i_stream == null)
     {
         byte[] buffer = ms.GetBuffer();
         int    length = (int)ms.Length;
         ms = null;
         if (chunked)
         {
             this.chunked = true;
             context.Response.SendChunked = true;
             i_stream = new ChunkedInputStream(context, stream, buffer, position, length - position);
         }
         else
         {
             i_stream = new RequestStream(stream, buffer, position, length - position, contentlength);
         }
     }
     return(i_stream);
 }
        public RequestStream GetRequestStream(bool chunked, long contentlength)
        {
            if (_inputStream == null)
            {
                var buffer = _requestBuffer.GetBuffer();
                var length = buffer.Length;
                _requestBuffer = null;
                if (chunked)
                {
                    _chunked = true;
                    _context.Response.SendChunked = true;
                    _inputStream = new ChunkedInputStream(_context, _stream, buffer, _position, length - _position);
                }
                else
                {
                    _inputStream = new RequestStream(_stream, buffer, _position, length - _position, contentlength);
                }
            }

            return(_inputStream);
        }