Inheritance: Microsoft.AspNet.Server.Kestrel.Http.ConnectionContext
Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public TestInput()
 {
     var memory = new MemoryPool();
     FrameContext = new FrameContext
     {
         SocketInput = new SocketInput(memory),
         Memory = memory,
         ConnectionControl = this,
         FrameControl = this
     };
 }
Exemplo n.º 4
0
 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
     };
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);
 }
Exemplo n.º 8
0
 public ForRemainingData(FrameContext context)
     : base(context)
 {
 }
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
     _state = FrameStreamState.Closed;
 }
Exemplo n.º 10
0
 protected MessageBody(FrameContext context)
 {
     _context = context;
 }
 public MessageBodyExchanger(FrameContext context)
 {
     _context = context;
     _buffer = new ArraySegment<byte>(_context.Memory.Empty);
 }
Exemplo n.º 12
0
 protected MessageBody(FrameContext context)
 {
     _context = context;
 }
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
 }
Exemplo n.º 14
0
 protected MessageBody(FrameContext context) : base(context)
 {
 }
Exemplo n.º 15
0
 public ForChunkedEncoding(bool keepAlive, FrameContext context)
     : base(context)
 {
     RequestKeepAlive = keepAlive;
 }
Exemplo n.º 16
0
 public ForRemainingData(FrameContext context)
     : base(context)
 {
 }
Exemplo n.º 17
0
 protected MessageBody(FrameContext context)
     : base(context)
 {
 }
Exemplo n.º 18
0
 public ForChunkedEncoding(bool keepAlive, FrameContext context)
     : base(context)
 {
     RequestKeepAlive = keepAlive;
 }
Exemplo n.º 19
0
 public ForContentLength(bool keepAlive, int contentLength, FrameContext context)
     : base(context)
 {
     RequestKeepAlive = keepAlive;
     _contentLength = contentLength;
     _neededLength = _contentLength;
 }
Exemplo n.º 20
0
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
 }
Exemplo n.º 21
0
 public FrameResponseStream(FrameContext context)
 {
     _context = context;
     _state   = FrameStreamState.Closed;
 }