示例#1
0
        private void Initialize(byte[] bytes)
        {
            var data = Encoding.UTF8.GetString(bytes);
            using (var reader = new StringReader(data))
            {
                _requestLine = new RequestLine(reader.ReadLine());

                _headers = new HttpHeaderParser(reader).Parse();

                if (!_headers.AllKeys.Contains("Expect"))
                {
                    _stream = new MemoryStream(Encoding.UTF8.GetBytes(reader.ReadToEnd()));
                }
                else
                {
                    ProcessExpectContinue();
                    _headers.Remove("Expect");
                }
            }
        }
示例#2
0
        private void Initialize(byte[] bytes)
        {
            var data = Encoding.UTF8.GetString(bytes);

            using (var reader = new StringReader(data))
            {
                _requestLine = new RequestLine(reader.ReadLine());

                _headers = new HttpHeaderParser(reader).Parse();

                if (!_headers.AllKeys.Contains("Expect"))
                {
                    _stream = new MemoryStream(Encoding.UTF8.GetBytes(reader.ReadToEnd()));
                }
                else
                {
                    ProcessExpectContinue();
                    _headers.Remove("Expect");
                }
            }
        }