Inheritance: Microsoft.AspNet.Server.Kestrel.Http.ConnectionContext
        public static MessageBody For(
            string httpVersion,
            FrameRequestHeaders headers,
            FrameContext context)
        {
            // see also http://tools.ietf.org/html/rfc2616#section-4.4

            var keepAlive = httpVersion != "HTTP/1.0";

            var connection = headers.HeaderConnection.ToString();
            if (connection.Length > 0)
            {
                keepAlive = connection.Equals("keep-alive", StringComparison.OrdinalIgnoreCase);
            }

            var transferEncoding = headers.HeaderTransferEncoding.ToString();
            if (transferEncoding.Length > 0)
            {
                return new ForChunkedEncoding(keepAlive, context);
            }

            var contentLength = headers.HeaderContentLength.ToString();
            if (contentLength.Length > 0)
            {
                return new ForContentLength(keepAlive, int.Parse(contentLength), context);
            }

            if (keepAlive)
            {
                return new ForContentLength(true, 0, context);
            }

            return new ForRemainingData(context);
        }
        public static MessageBody For(
            string httpVersion,
            IDictionary<string, string[]> headers,
            FrameContext context)
        {
            // see also http://tools.ietf.org/html/rfc2616#section-4.4

            var keepAlive = httpVersion != "HTTP/1.0";

            string connection;
            if (TryGet(headers, "Connection", out connection))
            {
                keepAlive = connection.Equals("keep-alive", StringComparison.OrdinalIgnoreCase);
            }

            string transferEncoding;
            if (TryGet(headers, "Transfer-Encoding", out transferEncoding))
            {
                return new ForChunkedEncoding(keepAlive, context);
            }

            string contentLength;
            if (TryGet(headers, "Content-Length", out contentLength))
            {
                return new ForContentLength(keepAlive, int.Parse(contentLength), context);
            }

            if (keepAlive)
            {
                return new ForContentLength(true, 0, context);
            }

            return new ForRemainingData(context);
        }
 public TestInput()
 {
     var memory = new MemoryPool();
     FrameContext = new FrameContext
     {
         SocketInput = new SocketInput(memory),
         Memory = memory,
         ConnectionControl = this,
         FrameControl = this
     };
 }
 public TestInput()
 {
     var trace = new KestrelTrace(new TestKestrelTrace());
     var ltp = new LoggingThreadPool(trace);
     var memory2 = new MemoryPool2();
     FrameContext = new FrameContext
     {
         SocketInput = new SocketInput(memory2, ltp),
         ConnectionControl = this,
         FrameControl = this
     };
 }
        public static MessageBody For(
            string httpVersion,
            IDictionary <string, StringValues> headers,
            FrameContext context)
        {
            // see also http://tools.ietf.org/html/rfc2616#section-4.4

            var keepAlive = httpVersion != "HTTP/1.0";

            string connection;

            if (TryGet(headers, "Connection", out connection))
            {
                keepAlive = connection.Equals("keep-alive", StringComparison.OrdinalIgnoreCase);
            }

            string transferEncoding;

            if (TryGet(headers, "Transfer-Encoding", out transferEncoding))
            {
                return(new ForChunkedEncoding(keepAlive, context));
            }

            string contentLength;

            if (TryGet(headers, "Content-Length", out contentLength))
            {
                return(new ForContentLength(keepAlive, int.Parse(contentLength), context));
            }

            if (keepAlive)
            {
                return(new ForContentLength(true, 0, context));
            }

            return(new ForRemainingData(context));
        }
        public static MessageBody For(
            string httpVersion,
            FrameRequestHeaders headers,
            FrameContext context)
        {
            // see also http://tools.ietf.org/html/rfc2616#section-4.4

            var keepAlive = httpVersion != "HTTP/1.0";

            var connection = headers.HeaderConnection.ToString();

            if (connection.Length > 0)
            {
                keepAlive = connection.Equals("keep-alive", StringComparison.OrdinalIgnoreCase);
            }

            var transferEncoding = headers.HeaderTransferEncoding.ToString();

            if (transferEncoding.Length > 0)
            {
                return(new ForChunkedEncoding(keepAlive, context));
            }

            var contentLength = headers.HeaderContentLength.ToString();

            if (contentLength.Length > 0)
            {
                return(new ForContentLength(keepAlive, int.Parse(contentLength), context));
            }

            if (keepAlive)
            {
                return(new ForContentLength(true, 0, context));
            }

            return(new ForRemainingData(context));
        }
 public MessageBodyExchanger(FrameContext context)
 {
     _context = context;
     _buffer  = new ArraySegment <byte>(_context.Memory.Empty);
 }
 public ForRemainingData(FrameContext context)
     : base(context)
 {
 }
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
     _state = FrameStreamState.Closed;
 }
 protected MessageBody(FrameContext context)
 {
     _context = context;
 }
 public MessageBodyExchanger(FrameContext context)
 {
     _context = context;
     _buffer = new ArraySegment<byte>(_context.Memory.Empty);
 }
 protected MessageBody(FrameContext context)
 {
     _context = context;
 }
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
 }
Exemple #14
0
 protected MessageBody(FrameContext context) : base(context)
 {
 }
 public ForChunkedEncoding(bool keepAlive, FrameContext context)
     : base(context)
 {
     RequestKeepAlive = keepAlive;
 }
 public ForRemainingData(FrameContext context)
     : base(context)
 {
 }
 protected MessageBody(FrameContext context)
     : base(context)
 {
 }
 public ForChunkedEncoding(bool keepAlive, FrameContext context)
     : base(context)
 {
     RequestKeepAlive = keepAlive;
 }
 public ForContentLength(bool keepAlive, int contentLength, FrameContext context)
     : base(context)
 {
     RequestKeepAlive = keepAlive;
     _contentLength = contentLength;
     _neededLength = _contentLength;
 }
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
 }
Exemple #21
0
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
     _state   = FrameStreamState.Closed;
 }