コード例 #1
0
        /// <summary>
        /// Send the response header and get a stream to which the body can be written.
        /// </summary>
        /// <returns>The Stream for the body.</returns>
        public Stream Send()
        {
            Debug.Assert(_stream == null);

            if (ChunkedTransferEncoding)
            {
                throw new HTTPException("Chunked transfer encoding is not (yet) supported");
            }
            else if (ContentLength != UNKNOWN_CONTENT_LENGTH)
            {
                CountingOutputStream co = new CountingOutputStream();
                Write(co);
                _stream = new HTTPFixedLengthOutputStream(_session, ContentLength + co.Length);
                Write(_stream);
            }
            else
            {
                KeepAlive = false;
                _stream   = new HTTPOutputStream(_session);
                Write(_stream);
            }

            return(_stream);
        }
コード例 #2
0
        /// <summary>
        /// Send the response header and get a stream to which the body can be written.
        /// </summary>
        /// <returns>The Stream for the body.</returns>
        public Stream Send()
        {
            //Debug.Assert(_stream == null);

            if (ChunkedTransferEncoding)
                throw new HTTPException("Chunked transfer encoding is not (yet) supported");
            else if (ContentLength != UNKNOWN_CONTENT_LENGTH)
            {
                CountingOutputStream co = new CountingOutputStream();
                Write(co);
                _stream = new HTTPFixedLengthOutputStream(_session, ContentLength + co.Length);
                Write(_stream);
            }
            else
            {
                KeepAlive = false;
                _stream = new HTTPOutputStream(_session);
                Write(_stream);
            }

            return _stream;
        }
コード例 #3
0
        /// <summary>
        /// Send the response header and get a stream to which the body can be written.
        /// </summary>
        /// <returns>The Stream for the body.</returns>
        public Stream Send()
        {
            Debug.Assert(_stream == null);

            if (ChunkedTransferEncoding)
            {
                _stream = new HTTPOutputStream(_session);
                Write(_stream);
                _stream = new ChunkedStream(_session);
            }
            else if (ContentLength != UNKNOWN_CONTENT_LENGTH)
            {
                CountingOutputStream co = new CountingOutputStream();
                Write(co);
                _stream = new HTTPFixedLengthOutputStream(_session, ContentLength + co.Length);
                Write(_stream);
            }
            else
            {
                KeepAlive = false;
                _stream = new HTTPOutputStream(_session);
                Write(_stream);
            }

            return _stream;
        }