/// <summary> /// Process the web response and output corresponding objects. /// </summary> /// <param name="response"></param> internal override void ProcessResponse(WebResponse response) { if (null == response) { throw new ArgumentNullException("response"); } // check for Server Core, throws exception if -UseBasicParsing is not used if (ShouldWriteToPipeline && (!UseBasicParsing)) { VerifyInternetExplorerAvailable(true); } Stream responseStream = StreamHelper.GetResponseStream(response); if (ShouldWriteToPipeline) { // creating a MemoryStream wrapper to response stream here to support IsStopping. responseStream = new WebResponseContentMemoryStream(responseStream, StreamHelper.ChunkSize, this); WebResponseObject ro = WebResponseObjectFactory.GetResponseObject(response, responseStream, this.Context, UseBasicParsing); WriteObject(ro); // use the rawcontent stream from WebResponseObject for further // processing of the stream. This is need because WebResponse's // stream can be used only once. responseStream = ro.RawContentStream; responseStream.Seek(0, SeekOrigin.Begin); } if (ShouldSaveToOutFile) { StreamHelper.SaveStreamToFile(responseStream, QualifiedOutFile, this); } }
/// <summary> /// Process the web response and output corresponding objects. /// </summary> /// <param name="response"></param> internal override void ProcessResponse(HttpResponseMessage response) { if (null == response) { throw new ArgumentNullException("response"); } Stream responseStream = StreamHelper.GetResponseStream(response); if (ShouldWriteToPipeline) { // creating a MemoryStream wrapper to response stream here to support IsStopping. responseStream = new WebResponseContentMemoryStream(responseStream, StreamHelper.ChunkSize, this); WebResponseObject ro = WebResponseObjectFactory.GetResponseObject(response, responseStream, this.Context); ro.RelationLink = _relationLink; WriteObject(ro); // use the rawcontent stream from WebResponseObject for further // processing of the stream. This is need because WebResponse's // stream can be used only once. responseStream = ro.RawContentStream; responseStream.Seek(0, SeekOrigin.Begin); } if (ShouldSaveToOutFile) { StreamHelper.SaveStreamToFile(responseStream, QualifiedOutFile, this); } }
internal override void ProcessResponse(WebResponse response) { if (response == null) { throw new ArgumentNullException("response"); } if (base.ShouldWriteToPipeline && (this.UseBasicParsing == 0)) { base.VerifyInternetExplorerAvailable(true); } MemoryStream contentStream = null; using (Stream stream2 = StreamHelper.GetResponseStream(response)) { contentStream = StreamHelper.ReadStream(stream2, response.ContentLength, this); } if (base.ShouldWriteToPipeline) { WebResponseObject sendToPipeline = WebResponseObjectFactory.GetResponseObject(response, contentStream, base.Context, (bool)this.UseBasicParsing); base.WriteObject(sendToPipeline); } if (base.ShouldSaveToOutFile) { StreamHelper.SaveStreamToFile(contentStream, base.QualifiedOutFile, this); } }
/// <summary> /// Process the web response and output corresponding objects. /// </summary> /// <param name="response"></param> internal override void ProcessResponse(HttpResponseMessage response) { if (null == response) { throw new ArgumentNullException("response"); } // check for Server Core, throws exception if -UseBasicParsing is not used if (ShouldWriteToPipeline && !UseBasicParsing) { // IE is not available in PS Linux, and may not available in PS Core depending on // where it's running (desktop/nano/iot). // For PS Linux and PS Core, if IE is not available, we always use basic parsing. if (!VerifyInternetExplorerAvailable(true)) { UseBasicParsing = true; } } Stream responseStream = StreamHelper.GetResponseStream(response); if (ShouldWriteToPipeline) { // creating a MemoryStream wrapper to response stream here to support IsStopping. responseStream = new WebResponseContentMemoryStream(responseStream, StreamHelper.ChunkSize, this); WebResponseObject ro = WebResponseObjectFactory.GetResponseObject(response, responseStream, this.Context, UseBasicParsing); ro.RelationLink = _relationLink; WriteObject(ro); // use the rawcontent stream from WebResponseObject for further // processing of the stream. This is need because WebResponse's // stream can be used only once. responseStream = ro.RawContentStream; responseStream.Seek(0, SeekOrigin.Begin); } if (ShouldSaveToOutFile) { StreamHelper.SaveStreamToFile(responseStream, QualifiedOutFile, this); } }