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 <dmitriy@dominodatalab.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Abhinav Singh 2022-10-22 09:34:02 +05:30 committed by GitHub
parent c200e6399f
commit 4ee982a116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -234,6 +234,7 @@ class HttpProtocolHandler(BaseTcpServerHandler[HttpClientConnection]):
logger.warning( logger.warning(
'Exception when receiving from %s connection#%d with reason %r' % 'Exception when receiving from %s connection#%d with reason %r' %
(self.work.tag, self.work.connection.fileno(), e), (self.work.tag, self.work.connection.fileno(), e),
exc_info=True,
) )
return True return True
return False return False

View File

@ -13,13 +13,13 @@ import random
import logging import logging
from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Optional from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Optional
from . import HttpWebServerBasePlugin, httpProtocolTypes from proxy.http import Url
from .. import Url from proxy.core.base import TcpUpstreamConnectionHandler
from ..parser import HttpParser from proxy.http.parser import HttpParser
from ..exception import HttpProtocolException from proxy.http.server import HttpWebServerBasePlugin, httpProtocolTypes
from ...core.base import TcpUpstreamConnectionHandler from proxy.common.utils import text_
from ...common.utils import text_ from proxy.http.exception import HttpProtocolException
from ...common.constants import ( from proxy.common.constants import (
HTTPS_PROTO, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT, HTTPS_PROTO, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT,
DEFAULT_REVERSE_PROXY_ACCESS_LOG_FORMAT, DEFAULT_REVERSE_PROXY_ACCESS_LOG_FORMAT,
) )
@ -99,6 +99,7 @@ class ReverseProxy(TcpUpstreamConnectionHandler, HttpWebServerBasePlugin):
self.choice.hostname, self.choice.hostname,
), ),
as_non_blocking=True, as_non_blocking=True,
ca_file=self.flags.ca_file,
) )
request.path = self.choice.remainder request.path = self.choice.remainder
self.upstream.queue(memoryview(request.build())) self.upstream.queue(memoryview(request.build()))