fixbuild fail with python3.7
(cherry picked from commit 985226be86ed6d31d7bfa42c1bb720d0eee02009)
This commit is contained in:
parent
5067de5552
commit
f5958c88c3
64
fix-build-fail-with-python3.7.patch
Normal file
64
fix-build-fail-with-python3.7.patch
Normal file
@ -0,0 +1,64 @@
|
||||
diff -Nur mitmproxy-7.0.0/mitmproxy/contentviews/__init__.py mitmproxy-7.0.0-1/mitmproxy/contentviews/__init__.py
|
||||
--- mitmproxy-7.0.0/mitmproxy/contentviews/__init__.py 2021-07-16 16:24:38.000000000 +0800
|
||||
+++ mitmproxy-7.0.0-1/mitmproxy/contentviews/__init__.py 2021-08-04 15:27:39.221691053 +0800
|
||||
@@ -99,8 +99,10 @@
|
||||
http_message = None
|
||||
if isinstance(message, http.Message):
|
||||
http_message = message
|
||||
- if ctype := message.headers.get("content-type"):
|
||||
- if ct := http.parse_content_type(ctype):
|
||||
+ ctype_tmp = message.headers.get("content-type")
|
||||
+ if ctype == ctype_tmp:
|
||||
+ ct_tmp = http.parse_content_type(ctype)
|
||||
+ if ct == ct_tmp:
|
||||
content_type = f"{ct[0]}/{ct[1]}"
|
||||
|
||||
description, lines, error = get_content_view(
|
||||
diff -Nur mitmproxy-7.0.0/mitmproxy/net/tls.py mitmproxy-7.0.0-1/mitmproxy/net/tls.py
|
||||
--- mitmproxy-7.0.0/mitmproxy/net/tls.py 2021-07-16 16:24:38.000000000 +0800
|
||||
+++ mitmproxy-7.0.0-1/mitmproxy/net/tls.py 2021-08-04 15:32:53.086778204 +0800
|
||||
@@ -106,7 +106,7 @@
|
||||
ok += SSL._lib.SSL_CTX_set_max_proto_version(context._context, max_version.value) # type: ignore
|
||||
if ok != 2:
|
||||
raise RuntimeError(
|
||||
- f"Error setting TLS versions ({min_version=}, {max_version=}). "
|
||||
+ f"Error setting TLS versions ({min_version}, {max_version}). "
|
||||
"The version you specified may be unavailable in your libssl."
|
||||
)
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
try:
|
||||
context.load_verify_locations(ca_pemfile, ca_path)
|
||||
except SSL.Error as e:
|
||||
- raise RuntimeError(f"Cannot load trusted certificates ({ca_pemfile=}, {ca_path=}).") from e
|
||||
+ raise RuntimeError(f"Cannot load trusted certificates ({ca_pemfile}, {ca_path}).") from e
|
||||
|
||||
# Client Certs
|
||||
if client_cert:
|
||||
diff -Nur mitmproxy-7.0.0/mitmproxy/proxy/layers/http/__init__.py mitmproxy-7.0.0-1/mitmproxy/proxy/layers/http/__init__.py
|
||||
--- mitmproxy-7.0.0/mitmproxy/proxy/layers/http/__init__.py 2021-07-16 16:24:38.000000000 +0800
|
||||
+++ mitmproxy-7.0.0-1/mitmproxy/proxy/layers/http/__init__.py 2021-08-04 15:30:16.424239006 +0800
|
||||
@@ -148,8 +148,8 @@
|
||||
else:
|
||||
self.flow = event.replay_flow
|
||||
self.flow.request = event.request
|
||||
-
|
||||
- if err := validate_request(self.mode, self.flow.request):
|
||||
+ err_tmp = validate_request(self.mode, self.flow.request)
|
||||
+ if err == err_tmp:
|
||||
self.flow.response = http.Response.make(502, str(err))
|
||||
self.client_state = self.state_errored
|
||||
return (yield from self.send_response())
|
||||
diff -Nur mitmproxy-7.0.0/mitmproxy/proxy/server.py mitmproxy-7.0.0-1/mitmproxy/proxy/server.py
|
||||
--- mitmproxy-7.0.0/mitmproxy/proxy/server.py 2021-07-16 16:24:38.000000000 +0800
|
||||
+++ mitmproxy-7.0.0-1/mitmproxy/proxy/server.py 2021-08-04 15:31:48.925738277 +0800
|
||||
@@ -142,7 +142,8 @@
|
||||
server=command.connection
|
||||
)
|
||||
await self.handle_hook(server_hooks.ServerConnectHook(hook_data))
|
||||
- if err := command.connection.error:
|
||||
+ err_tmp = command.connection.error
|
||||
+ if err == err_tmp:
|
||||
self.log(f"server connection to {human.format_address(command.connection.address)} killed before connect: {err}")
|
||||
self.server_event(events.OpenConnectionCompleted(command, f"Connection killed: {err}"))
|
||||
return
|
||||
@ -1,11 +1,12 @@
|
||||
%global _empty_manifest_terminate_build 0
|
||||
Name: python-mitmproxy
|
||||
Version: 7.0.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: An interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets.
|
||||
License: MIT
|
||||
URL: https://github.com/mitmproxy/mitmproxy/
|
||||
Source0: https://github.com/mitmproxy/mitmproxy/archive/refs/tags/v%{version}.tar.gz
|
||||
Patch0: fix-build-fail-with-python3.7.patch
|
||||
BuildArch: noarch
|
||||
Requires: python3-asgiref python3-blinker python3-Brotli python3-certifi python3-click
|
||||
Requires: python3-cryptography python3-flask python3-h11 python3-h2 python3-hyperframe
|
||||
@ -33,7 +34,7 @@ Provides: python3-mitmproxy-doc
|
||||
mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets.
|
||||
|
||||
%prep
|
||||
%autosetup -n mitmproxy-%{version}
|
||||
%autosetup -n mitmproxy-%{version} -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
@ -73,5 +74,8 @@ mv %{buildroot}/doclist.lst .
|
||||
%{_docdir}/*
|
||||
|
||||
%changelog
|
||||
* Sat Aug 21 2021 liyanan <liyanan32@huawei.com> - 7.0.0-2
|
||||
- fix build fail with python3.7
|
||||
|
||||
* Fri Jul 30 2021 liyanan <liyanan32@huawei.com> - 7.0.0-1
|
||||
- package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user