Skip to content

Commit 7d0d780

Browse files
committed
Pass --rewrite-host-header for integration tests
1 parent b952d5d commit 7d0d780

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

proxy/common/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
from types import TracebackType
2626
from typing import Any, Dict, List, Type, Tuple, Callable, Optional
2727

28-
# noqa: WPS436
29-
import _ssl # type: ignore[import-not-found]
30-
3128
from .types import HostPort
3229
from .constants import (
3330
CRLF, COLON, HTTP_1_1, IS_WINDOWS, WHITESPACE, DEFAULT_TIMEOUT,
@@ -43,6 +40,9 @@
4340

4441
def cert_der_to_dict(der: Optional[bytes]) -> Dict[str, Any]:
4542
"""Parse a DER formatted certificate to a python dict"""
43+
# pylint: disable=import-outside-toplevel
44+
import _ssl # noqa: WPS436
45+
4646
if not der:
4747
return {}
4848
with tempfile.NamedTemporaryFile(delete=False) as cert_file:

tests/integration/test_integration.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,30 @@ def proxy_py_subprocess(request: Any) -> Generator[int, None, None]:
181181
ca_cert_dir = TEMP_DIR / ('certificates-%s' % run_id)
182182
os.makedirs(ca_cert_dir, exist_ok=True)
183183
proxy_cmd = (
184-
sys.executable, '-m', 'proxy',
185-
'--hostname', '127.0.0.1',
186-
'--port', '0',
187-
'--port-file', str(port_file),
184+
sys.executable,
185+
'-m',
186+
'proxy',
187+
'--hostname',
188+
'127.0.0.1',
189+
'--port',
190+
'0',
191+
'--port-file',
192+
str(port_file),
188193
'--enable-web-server',
189-
'--plugin', 'proxy.plugin.WebServerPlugin',
194+
'--plugin',
195+
'proxy.plugin.WebServerPlugin',
190196
'--enable-reverse-proxy',
191-
'--plugin', 'proxy.plugin.ReverseProxyPlugin',
192-
'--num-acceptors', '3',
193-
'--num-workers', '3',
194-
'--ca-cert-dir', str(ca_cert_dir),
195-
'--log-level', 'd',
197+
'--plugin',
198+
'proxy.plugin.ReverseProxyPlugin',
199+
'--rewrite-host-header',
200+
'--num-acceptors',
201+
'3',
202+
'--num-workers',
203+
'3',
204+
'--ca-cert-dir',
205+
str(ca_cert_dir),
206+
'--log-level',
207+
'd',
196208
) + tuple(request.param.split())
197209
proxy_proc = Popen(proxy_cmd, stderr=subprocess.STDOUT)
198210
# Needed because port file might not be available immediately

0 commit comments

Comments
 (0)