示例#1
0
 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, _logger, _cryptoProvider, _memoryStreamFactory, _textEncoding, _fileSystem);
 }
示例#2
0
 private void InitInternal()
 {
     _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, _textEncoding);
 }
示例#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);
 }