コード例 #1
0
            internal VirtualStateParser Parse()
            {
                while (!HasCompleted)
                {
                    try
                    {
                        if (IsNotStarted)
                        {
                            NextStep();
                        }
                        else if (IsRequestLineStep)
                        {
                            ParseRequestLine();
                        }
                        else if (IsHeadersStep)
                        {
                            ParseHeaders();
                        }
                        else if (IsBodyStep)
                        {
                            ParseBody();
                        }
                        else if (IsCompletedStep)
                        {
                            _continuation = false;
                            NewRequest();
                        }
                    }
                    catch (OutOfContentException)
                    {
                        _continuation     = true;
                        _outOfContentTime = (long)DateExtensions.GetCurrentMillis();
                        return(this);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

                return(this);
            }
コード例 #2
0
            internal VirtualStateParser Parse()
            {
                while (!HasCompleted)
                {
                    try
                    {
                        if (IsNotStarted)
                        {
                            NextStep();
                        }
                        else if (IsStatusLineStep)
                        {
                            ParseStatusLine();
                        }
                        else if (IsHeadersStep)
                        {
                            ParseHeaders();
                        }
                        else if (IsBodyStep)
                        {
                            ParseBody();
                        }
                        else if (IsCompletedStep)
                        {
                            _continuation = false;
                            NewResponse();
                        }
                    }
                    catch (OutOfContentException)
                    {
                        _continuation     = true;
                        _outOfContentTime = (long)DateExtensions.GetCurrentMillis();
                        return(this);
                    }
                }

                PrepareForStream();

                return(this);
            }
コード例 #3
0
            internal VirtualStateParser Parse()
            {
                var isOutOfContent = false;

                while (!HasCompleted)
                {
                    if (IsNotStarted)
                    {
                        isOutOfContent = NextStep();
                    }
                    else if (IsRequestLineStep)
                    {
                        isOutOfContent = ParseRequestLine();
                    }
                    else if (IsHeadersStep)
                    {
                        isOutOfContent = ParseHeaders();
                    }
                    else if (IsBodyStep)
                    {
                        isOutOfContent = ParseBody();
                    }
                    else if (IsCompletedStep)
                    {
                        _continuation  = false;
                        isOutOfContent = NewRequest();
                    }

                    if (isOutOfContent)
                    {
                        _continuation     = true;
                        _outOfContentTime = (long)DateExtensions.GetCurrentMillis();
                        return(this);
                    }
                }

                return(this);
            }
コード例 #4
0
 internal bool HasMissingContentTimeExpired(long timeLimit)
 => _outOfContentTime + timeLimit < DateExtensions.GetCurrentMillis();