!14 [sync] PR-10: 修复mitmproxy运行告警
From: @openeuler-sync-bot Reviewed-by: @shinwell_hu Signed-off-by: @shinwell_hu
This commit is contained in:
commit
e6c42c7ec6
57
0002-fix-asyncio_utils-run-in-python3.7.patch
Normal file
57
0002-fix-asyncio_utils-run-in-python3.7.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From 1f3587e008dc7314a81db4cf998ea14f48d407ec Mon Sep 17 00:00:00 2001
|
||||||
|
From: gitee-cmd <chemingdao@huawei.com>
|
||||||
|
Date: Fri, 15 Oct 2021 10:07:57 +0800
|
||||||
|
Subject: [PATCH] fix asyncio_utils run in python3.7
|
||||||
|
|
||||||
|
---
|
||||||
|
mitmproxy/utils/asyncio_utils.py | 9 +++------
|
||||||
|
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mitmproxy/utils/asyncio_utils.py b/mitmproxy/utils/asyncio_utils.py
|
||||||
|
index 2feaaae..71972ab 100644
|
||||||
|
--- a/mitmproxy/utils/asyncio_utils.py
|
||||||
|
+++ b/mitmproxy/utils/asyncio_utils.py
|
||||||
|
@@ -29,37 +29,34 @@ def create_task(
|
||||||
|
Ideally we stop closing the event loop during shutdown and then remove this parameter.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
- t = asyncio.create_task(coro, name=name)
|
||||||
|
+ t = asyncio.create_task(coro)
|
||||||
|
except RuntimeError:
|
||||||
|
if ignore_closed_loop:
|
||||||
|
coro.close()
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
- set_task_debug_info(t, name=name, client=client)
|
||||||
|
+ set_task_debug_info(t, client=client)
|
||||||
|
return t
|
||||||
|
|
||||||
|
|
||||||
|
def set_task_debug_info(
|
||||||
|
task: asyncio.Task,
|
||||||
|
*,
|
||||||
|
- name: str,
|
||||||
|
client: Optional[tuple] = None,
|
||||||
|
) -> None:
|
||||||
|
"""Set debug info for an externally-spawned task."""
|
||||||
|
task.created = time.time() # type: ignore
|
||||||
|
- task.set_name(name)
|
||||||
|
if client:
|
||||||
|
task.client = client # type: ignore
|
||||||
|
|
||||||
|
|
||||||
|
def task_repr(task: asyncio.Task) -> str:
|
||||||
|
"""Get a task representation with debug info."""
|
||||||
|
- name = task.get_name()
|
||||||
|
age = getattr(task, "created", "")
|
||||||
|
if age:
|
||||||
|
age = f" (age: {time.time() - age:.0f}s)"
|
||||||
|
client = getattr(task, "client", "")
|
||||||
|
if client:
|
||||||
|
client = f"{human.format_address(client)}: "
|
||||||
|
- return f"{client}{name}{age}"
|
||||||
|
+ return f"{client}{age}"
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
@ -1,13 +1,14 @@
|
|||||||
%global _empty_manifest_terminate_build 0
|
%global _empty_manifest_terminate_build 0
|
||||||
Name: python-mitmproxy
|
Name: python-mitmproxy
|
||||||
Version: 7.0.0
|
Version: 7.0.0
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: An interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets.
|
Summary: An interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets.
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/mitmproxy/mitmproxy/
|
URL: https://github.com/mitmproxy/mitmproxy/
|
||||||
Source0: https://github.com/mitmproxy/mitmproxy/archive/refs/tags/v%{version}.tar.gz
|
Source0: https://github.com/mitmproxy/mitmproxy/archive/refs/tags/v%{version}.tar.gz
|
||||||
Patch0: fix-build-fail-with-python3.7.patch
|
Patch0: fix-build-fail-with-python3.7.patch
|
||||||
Patch0001: 0001-fix-run-in-python-3.7-environment.patch
|
Patch0001: 0001-fix-run-in-python-3.7-environment.patch
|
||||||
|
Patch0002: 0002-fix-asyncio_utils-run-in-python3.7.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Requires: python3-asgiref python3-blinker python3-Brotli python3-certifi python3-click
|
Requires: python3-asgiref python3-blinker python3-Brotli python3-certifi python3-click
|
||||||
Requires: python3-cryptography python3-flask python3-h11 python3-h2 python3-hyperframe
|
Requires: python3-cryptography python3-flask python3-h11 python3-h2 python3-hyperframe
|
||||||
@ -76,6 +77,9 @@ mv %{buildroot}/doclist.lst .
|
|||||||
%{_docdir}/*
|
%{_docdir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Oct 15 2021 chemingdao <chemingdao@huawei.com> - 7.0.0-4
|
||||||
|
- fix asynocio utils run in python3.7
|
||||||
|
|
||||||
* Thu Sep 30 2021 chemingdao <chemingdao@huawei.com> - 7.0.0-3
|
* Thu Sep 30 2021 chemingdao <chemingdao@huawei.com> - 7.0.0-3
|
||||||
- fix run in python 3.7 environment
|
- fix run in python 3.7 environment
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user