Пример #1
0
        public void BeginRequest(HttpWebRequest request)
        {
            HttpReadState = new HttpReadState(request);

            if (TimeoutInMilliseconds != -1)
            {
                request.Timeout = TimeoutInMilliseconds;
            }
        }
Пример #2
0
        //Explicit interface as we don't want outsiders calling this guy.
        internal void Dispose()
        {
            BufferPool.Return(HttpReadState.Buffer);

            if (HttpReadState.StringDecoder != null)
            {
                HttpReadState.StringDecoder.Dispose();
            }

            if (HttpReadState.WebRequest != null)
            {
                HttpReadState.WebRequest.Abort();
            }

            if (HttpReadState.WebResponse != null)
            {
                var responseAsDisposable = (IDisposable)HttpReadState.WebResponse;
                responseAsDisposable.Dispose();
            }
            
            //Clears all state and will cause reading for this command to stop.
            HttpReadState = new HttpReadState();
        }