Exemple #1
0
        private static void FinishRequest(HTTPRequest req, HTTP2Response resp, FramesAsStreamView dataStream)
        {
            if (dataStream != null)
            {
                resp.AddData(dataStream);

                dataStream.Close();
            }

            bool resendRequest;
            HTTPConnectionStates proposedConnectionStates;
            KeepAliveHeader      keepAliveHeader = null;

            ConnectionHelper.HandleResponse("HTTP2Stream", req, out resendRequest, out proposedConnectionStates, ref keepAliveHeader);

            if (resendRequest && !req.IsCancellationRequested)
            {
                RequestEventHelper.EnqueueRequestEvent(new RequestEventInfo(req, RequestEvents.Resend));
            }
            else if (req.State == HTTPRequestStates.Processing && !req.IsCancellationRequested)
            {
                req.State = HTTPRequestStates.Finished;
            }
            else
            {
                if (req.State == HTTPRequestStates.Processing && req.IsCancellationRequested)
                {
                    req.State = req.IsTimedOut ? HTTPRequestStates.TimedOut : HTTPRequestStates.Aborted;
                }
            }
        }
Exemple #2
0
        private static void FinishRequest(HTTP2Stream stream, FramesAsStreamView dataStream)
        {
            if (dataStream != null)
            {
                try
                {
                    stream.response.AddData(dataStream);
                }
                finally
                {
                    dataStream.Close();
                }
            }

            stream.AssignedRequest.Timing.Add(TimingEventNames.Response_Received);

            bool resendRequest;
            HTTPConnectionStates proposedConnectionStates; // ignored
            KeepAliveHeader      keepAliveHeader = null;   // ignored

            ConnectionHelper.HandleResponse("HTTP2Stream", stream.AssignedRequest, out resendRequest, out proposedConnectionStates, ref keepAliveHeader, stream.Context, stream.AssignedRequest.Context);

            if (resendRequest && !stream.AssignedRequest.IsCancellationRequested)
            {
                RequestEventHelper.EnqueueRequestEvent(new RequestEventInfo(stream.AssignedRequest, RequestEvents.Resend));
            }
            else if (stream.AssignedRequest.State == HTTPRequestStates.Processing && !stream.AssignedRequest.IsCancellationRequested)
            {
                stream.AssignedRequest.State = HTTPRequestStates.Finished;
            }
            else
            {
                if (stream.AssignedRequest.State == HTTPRequestStates.Processing && stream.AssignedRequest.IsCancellationRequested)
                {
                    stream.AssignedRequest.State = stream.AssignedRequest.IsTimedOut ? HTTPRequestStates.TimedOut : HTTPRequestStates.Aborted;
                }
            }
        }
        private static void FinishRequest(HTTPRequest req, HTTP2Response resp, FramesAsStreamView dataStream)
        {
            if (dataStream != null)
            {
                resp.AddData(dataStream);

                dataStream.Close();
            }

            bool resendRequest;
            HTTPConnectionStates proposedConnectionStates;
            KeepAliveHeader      keepAliveHeader = null;

            ConnectionHelper.HandleResponse("HTTP2Stream", req, out resendRequest, out proposedConnectionStates, ref keepAliveHeader);

            if (resendRequest)
            {
                RequestEventHelper.EnqueueRequestEvent(new RequestEventInfo(req, RequestEvents.Resend));
            }
            else
            {
                req.State = HTTPRequestStates.Finished;
            }
        }