Changed iteration to list comprehension in order to prevent "RuntimeError: dictionary changed size during iteration"

This commit is contained in:
gorogoroumaru 2020-07-05 22:35:33 +09:00 committed by Thomas Kriechbaumer
parent 49e10d7cc2
commit b456c3afa1
2 changed files with 2 additions and 3 deletions

View File

@ -18,6 +18,7 @@ Unreleased: mitmproxy next
* mitmweb: "New -> File" menu option has been renamed to "Clear All" (@yogeshojha) * mitmweb: "New -> File" menu option has been renamed to "Clear All" (@yogeshojha)
* Add new MapRemote addon to rewrite URLs of requests (@mplattner) * Add new MapRemote addon to rewrite URLs of requests (@mplattner)
* Add support for HTTP Trailers to the HTTP/2 protocol (@sanlengjingvv and @Kriechi) * Add support for HTTP Trailers to the HTTP/2 protocol (@sanlengjingvv and @Kriechi)
* Fix certificate runtime error during expire cleanup (@gorogoroumaru)
* --- TODO: add new PRs above this line --- * --- TODO: add new PRs above this line ---

View File

@ -173,9 +173,7 @@ class CertStore:
self.expire_queue.append(entry) self.expire_queue.append(entry)
if len(self.expire_queue) > self.STORE_CAP: if len(self.expire_queue) > self.STORE_CAP:
d = self.expire_queue.pop(0) d = self.expire_queue.pop(0)
for k, v in list(self.certs.items()): self.certs = {k: v for k, v in self.certs.items() if v != d}
if v == d:
del self.certs[k]
@staticmethod @staticmethod
def load_dhparam(path): def load_dhparam(path):