/// <summary>cleanup work to do once the request has completed</summary> protected override void CompletedRequest() { byte[] buffer = this.asyncStreamCopyBuffer; this.asyncStreamCopyBuffer = null; if ((buffer != null) && !this.usingBuffer) { this.PutAsyncResponseStreamCopyBuffer(buffer); } if (this.responseStreamOwner) { if (this.outputResponseStream != null) { this.outputResponseStream.Position = 0; } } Debug.Assert(this.responseMessage != null || this.Failure != null || this.IsAborted, "should have response or exception"); if (this.responseMessage != null) { // we've cached off what we need, headers still accessible after close WebUtil.DisposeMessage(this.responseMessage); Version responseVersion; Exception ex = SaveResult.HandleResponse( this.RequestInfo, this.StatusCode, this.responseMessage.GetHeader(XmlConstants.HttpODataVersion), this.GetResponseStream, false, out responseVersion); if (ex != null) { this.HandleFailure(ex); } else { this.responseInfo = this.CreateResponseInfo(); } } }