Exemple #1
0
        public static HttpResponseObject ReadResponse(Stream stream)
        {
            byte[] buffer = Read(stream);
            if (buffer == null)
            {
                return(null);
            }

            HttpResponseHeader header  = new HttpResponseHeader(Encoding.UTF8.GetString(buffer));
            HttpContent        content = new HttpContent();

            if (0 < header._contentSize)
            {
                content.Set(ReadContent(stream, header._contentSize));
            }
            else if (header._isChunked)
            {
                content.Set(ReadChunked(stream));
            }
            HttpResponseObject response = new HttpResponseObject(header, content);

            return(response);
        }
Exemple #2
0
 public HttpResponseObject(HttpResponseHeader header, HttpContent content)
 {
     _header  = header;
     _content = content;
 }