From a88f951b2f86aee7c6a47ca1977cc93aaf229f6e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 13 Aug 2015 22:26:27 +0800 Subject: [PATCH] Always set headers for response When intercepting HTTP protocols Chromium will assume there is always headers set, so we have to provide headers for all the responses to avoid the crash. --- atom/browser/net/js_asker.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/atom/browser/net/js_asker.h b/atom/browser/net/js_asker.h index 63b3199..9c45446 100644 --- a/atom/browser/net/js_asker.h +++ b/atom/browser/net/js_asker.h @@ -11,6 +11,7 @@ #include "base/values.h" #include "content/public/browser/browser_thread.h" #include "net/base/net_errors.h" +#include "net/http/http_response_headers.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_job.h" #include "v8/include/v8.h" @@ -71,6 +72,9 @@ class JsAsker : public RequestJob { base::Bind(&JsAsker::OnResponse, weak_factory_.GetWeakPtr()))); } + void GetResponseInfo(net::HttpResponseInfo* info) override { + info->headers = new net::HttpResponseHeaders(""); + } // Called when the JS handler has sent the response, we need to decide whether // to start, or fail the job. -- 2.7.4