From 4ee982a116a95d085484df44bcd63e9b11f794ab Mon Sep 17 00:00:00 2001 From: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com> Date: Sat, 22 Oct 2022 09:34:02 +0530 Subject: [PATCH] Honor ca-file for reverse proxy upstream connections (#1283) * Make reverse proxy honor ca-file flag * Add stupid logging * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove print statements * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trigger build Co-authored-by: Dmitriy Volk Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- proxy/http/handler.py | 1 + proxy/http/server/reverse.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/proxy/http/handler.py b/proxy/http/handler.py index c8d07041..b8d207d5 100644 --- a/proxy/http/handler.py +++ b/proxy/http/handler.py @@ -234,6 +234,7 @@ class HttpProtocolHandler(BaseTcpServerHandler[HttpClientConnection]): logger.warning( 'Exception when receiving from %s connection#%d with reason %r' % (self.work.tag, self.work.connection.fileno(), e), + exc_info=True, ) return True return False diff --git a/proxy/http/server/reverse.py b/proxy/http/server/reverse.py index 11678d25..c4cadf3e 100644 --- a/proxy/http/server/reverse.py +++ b/proxy/http/server/reverse.py @@ -13,13 +13,13 @@ import random import logging from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Optional -from . import HttpWebServerBasePlugin, httpProtocolTypes -from .. import Url -from ..parser import HttpParser -from ..exception import HttpProtocolException -from ...core.base import TcpUpstreamConnectionHandler -from ...common.utils import text_ -from ...common.constants import ( +from proxy.http import Url +from proxy.core.base import TcpUpstreamConnectionHandler +from proxy.http.parser import HttpParser +from proxy.http.server import HttpWebServerBasePlugin, httpProtocolTypes +from proxy.common.utils import text_ +from proxy.http.exception import HttpProtocolException +from proxy.common.constants import ( HTTPS_PROTO, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT, DEFAULT_REVERSE_PROXY_ACCESS_LOG_FORMAT, ) @@ -99,6 +99,7 @@ class ReverseProxy(TcpUpstreamConnectionHandler, HttpWebServerBasePlugin): self.choice.hostname, ), as_non_blocking=True, + ca_file=self.flags.ca_file, ) request.path = self.choice.remainder self.upstream.queue(memoryview(request.build()))