From f930e8b9fe0e59e14c19646021e4861f053ccd9f Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 20:03:48 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/libproxy/extension_pacrunner.cpp b/libproxy/extension_pacrunner.cpp index d3dc787..c53c4f0 100644 --- a/libproxy/extension_pacrunner.cpp +++ b/libproxy/extension_pacrunner.cpp @@ -22,10 +22,20 @@ using namespace libproxy; pacrunner::pacrunner(string, const url&) {} -pacrunner_extension::pacrunner_extension() {} +pacrunner_extension::pacrunner_extension() { + this->pr = NULL; +} -pacrunner_extension::~pacrunner_extension() {} +pacrunner_extension::~pacrunner_extension() { + if (this->pr) delete this->pr; +} pacrunner* pacrunner_extension::get(string pac, const url& pacurl) throw (bad_alloc) { - return this->create(pac, pacurl); + if (this->pr) { + if (this->last == pac) + return this->pr; + delete this->pr; + } + + return this->pr = this->create(pac, pacurl); } diff --git a/libproxy/proxy.cpp b/libproxy/proxy.cpp index d122174..17e330b 100644 --- a/libproxy/proxy.cpp +++ b/libproxy/proxy.cpp @@ -416,9 +416,7 @@ void proxy_factory::run_pac(url &realurl, const url &confurl, vector &re /* Run the PAC, but only try one PACRunner */ if (debug) cerr << "Using pacrunner: " << typeid(*pacrunners[0]).name() << endl; - pacrunner* runner = pacrunners[0]->get(this->pac, this->pacurl->to_string()); - string pacresp = runner->run(realurl); - delete runner; + string pacresp = pacrunners[0]->get(this->pac, this->pacurl->to_string())->run(realurl); if (debug) cerr << "Pacrunner returned: " << pacresp << endl; format_pac_response(pacresp, response); }