From 93b444eef972968353e2bce08dd2b9e4338177cf Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 23 Mar 2017 23:36:05 +0530 Subject: [PATCH] net: catch source stream creation failure for content encoding --- atom/browser/net/atom_url_request.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/atom/browser/net/atom_url_request.cc b/atom/browser/net/atom_url_request.cc index 2c7bb61da0b1..83d2548a9c29 100644 --- a/atom/browser/net/atom_url_request.cc +++ b/atom/browser/net/atom_url_request.cc @@ -348,6 +348,14 @@ void AtomURLRequest::OnReadCompleted(net::URLRequest* request, int bytes_read) { DCHECK_EQ(request, request_.get()); const auto status = request_->status(); + if (status.error() == bytes_read && + bytes_read == net::ERR_CONTENT_DECODING_INIT_FAILED) { + // When the request job is unable to create a source stream for the + // content encoding, we fail the request. + DoCancelWithError(net::ErrorToString(net::ERR_CONTENT_DECODING_INIT_FAILED), + true); + return; + } bool response_error = false; bool data_ended = false;