Inheritance: System.IO.Stream
Example #1
0
 private void Init()
 {
     _contextBound   = false;
     _requestStream  = null;
     _responseStream = null;
     _prefix         = null;
     _chunked        = false;
     _memoryStream   = new MemoryStream();
     _position       = 0;
     _inputState     = InputState.RequestLine;
     _lineState      = LineState.None;
     _context        = new HttpListenerContext(this);
 }
Example #2
0
        private void Init()
        {
            if (_sslStream != null)
            {
                _sslStream.AuthenticateAsServer(_cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
            }

            _contextBound   = false;
            _requestStream  = null;
            _responseStream = null;
            _prefix         = null;
            _chunked        = false;
            _memoryStream   = new MemoryStream();
            _position       = 0;
            _inputState     = InputState.RequestLine;
            _lineState      = LineState.None;
            _context        = new HttpListenerContext(this);
        }
Example #3
0
 public HttpRequestStream GetRequestStream(bool chunked, long contentlength)
 {
     if (_requestStream == null)
     {
         byte[] buffer = _memoryStream.GetBuffer();
         int    length = (int)_memoryStream.Length;
         _memoryStream = null;
         if (chunked)
         {
             _chunked = true;
             _context.Response.SendChunked = true;
             _requestStream = new ChunkedInputStream(_context, _stream, buffer, _position, length - _position);
         }
         else
         {
             _requestStream = new HttpRequestStream(_stream, buffer, _position, length - _position, contentlength);
         }
     }
     return(_requestStream);
 }
        public WebSocketHttpListenerDuplexStream(HttpRequestStream inputStream,
            HttpResponseStream outputStream,
            HttpListenerContext context)
        {
            Contract.Assert(inputStream != null, "'inputStream' MUST NOT be NULL.");
            Contract.Assert(outputStream != null, "'outputStream' MUST NOT be NULL.");
            Contract.Assert(context != null, "'context' MUST NOT be NULL.");
            Contract.Assert(inputStream.CanRead, "'inputStream' MUST support read operations.");
            Contract.Assert(outputStream.CanWrite, "'outputStream' MUST support write operations.");

            m_InputStream = inputStream;
            m_OutputStream = outputStream;
            m_Context = context;

            if (WebSocketBase.LoggingEnabled)
            {
                Logging.Associate(Logging.WebSockets, inputStream, this);
                Logging.Associate(Logging.WebSockets, outputStream, this);
            }
        }
 public HttpRequestReader(Stream strm)
 {
     try
     {
         _strm = strm;
         _isClosed = false;
         _httpStrm = new HttpRequestStream(strm);
         Headers = new WebHeaderCollection();
         Cookies = new CookieContainer();
         ReadMessageHeader();
     }
     catch (Exception exception)
     {
         Close();
         throw exception;
     }
 }