Skip to content

v2.4.0rc4 #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c2588e6
Merge pull request #840 from abhinavsingh/release-schedule-notes
abhinavsingh Dec 1, 2021
298b71f
Green CI (#841)
abhinavsingh Dec 1, 2021
7e7a237
Cleanup parser & url classes (#843)
abhinavsingh Dec 1, 2021
e64c29b
pip prod(deps): bump twine from 3.6.0 to 3.7.0 (#845)
dependabot[bot] Dec 2, 2021
88c411d
npm: bump jasmine from 3.6.3 to 3.10.0 in /dashboard (#844)
dependabot[bot] Dec 2, 2021
fb85ee5
npm: bump chrome-devtools-frontend in /dashboard (#846)
dependabot[bot] Dec 3, 2021
1eeed91
pip prod(deps): bump coverage from 6.1.2 to 6.2 (#847)
dependabot[bot] Dec 3, 2021
0a0aa68
Fix GHA check-gate to properly identify failures (#849)
webknjaz Dec 4, 2021
2b00247
pip prod(deps): bump pylint from 2.12.1 to 2.12.2 (#851)
dependabot[bot] Dec 6, 2021
7246e37
npm: bump @types/js-cookie from 2.2.6 to 3.0.1 in /dashboard (#850)
dependabot[bot] Dec 6, 2021
ea2a3c4
pip prod(deps): bump sphinx from 4.3.0 to 4.3.1 (#853)
dependabot[bot] Dec 7, 2021
81c7ba7
pip prod(deps): bump paramiko from 2.8.0 to 2.8.1 (#855)
dependabot[bot] Dec 8, 2021
f410f46
npm: bump ws from 7.4.6 to 8.3.0 in /dashboard (#854)
dependabot[bot] Dec 8, 2021
ba6b45d
pip prod(deps): bump uvicorn from 0.15.0 to 0.16.0 (#857)
dependabot[bot] Dec 9, 2021
57aa628
npm: bump chrome-devtools-frontend in /dashboard (#856)
dependabot[bot] Dec 9, 2021
808c7e4
Process `--enable-*` flags before loading plugins (#860)
abhinavsingh Dec 11, 2021
b8e64a8
npm: bump http-server from 0.12.3 to 14.0.0 in /dashboard (#858)
dependabot[bot] Dec 12, 2021
84304ea
pip prod(deps): bump furo from 2021.11.15 to 2021.11.23 (#859)
dependabot[bot] Dec 12, 2021
4bc81f7
Update web log context fields to match proxy log context fields (#861)
abhinavsingh Dec 12, 2021
fc254f4
pip prod(deps): bump pytest-xdist from 2.4.0 to 2.5.0 (#864)
dependabot[bot] Dec 13, 2021
0d12873
npm: bump eslint-plugin-node from 10.0.0 to 11.1.0 in /dashboard (#863)
dependabot[bot] Dec 13, 2021
769aae4
Fix broken TLS interception & CacheResponsesPlugin because UID is no…
abhinavsingh Dec 17, 2021
bc8a511
Integrate showing unreleased changelog draft (#873)
webknjaz Dec 17, 2021
17eb2cf
pip prod(deps): bump types-paramiko from 2.8.2 to 2.8.4 (#868)
dependabot[bot] Dec 17, 2021
601e83c
npm: bump @types/jasmine from 3.6.1 to 3.10.2 in /dashboard (#867)
dependabot[bot] Dec 17, 2021
c56e0da
pip prod(deps): bump py-spy from 0.3.10 to 0.3.11 (#875)
dependabot[bot] Dec 17, 2021
b2612a1
[GHA] Add container integration test & publish containers to GHCR (#818)
abhinavsingh Dec 18, 2021
4496c23
Publish multi-platform containers on GHCR (#877)
abhinavsingh Dec 18, 2021
798faca
Publish multi-platform containers to DockerHub (#878)
abhinavsingh Dec 18, 2021
0a9b9a0
Use `--local-executor` flag by default for Docker container (#880)
abhinavsingh Dec 19, 2021
bf2d752
Merge branch 'master' into develop
abhinavsingh Dec 20, 2021
f2c88bb
Pre-evaluate `args.threadless = is_threadless` (#881)
abhinavsingh Dec 20, 2021
e653d5b
pip prod(deps): bump blacksheep from 1.2.1 to 1.2.2 (#885)
dependabot[bot] Dec 20, 2021
92671db
npm: bump chrome-devtools-frontend in /dashboard (#884)
dependabot[bot] Dec 20, 2021
88bbccb
Tag GHCR latest only when publishing from develop branch (#887)
abhinavsingh Dec 20, 2021
eaeadcc
Fix conditional for latest tag on GHCR (#889)
abhinavsingh Dec 20, 2021
8ef0fc9
pip prod(deps): bump mypy from 0.910 to 0.920 (#890)
dependabot[bot] Dec 21, 2021
5c62995
npm: bump chrome-devtools-frontend in /dashboard (#886)
dependabot[bot] Dec 21, 2021
91798fb
npm: bump jquery from 3.5.1 to 3.6.0 in /dashboard (#891)
dependabot[bot] Dec 21, 2021
ef730ec
[TLSInterception] Fix serial number generation (#892)
abhinavsingh Dec 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 27 additions & 35 deletions .github/workflows/test-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
sdist-artifact-name: ${{ steps.artifact-name.outputs.sdist }}
wheel-artifact-name: ${{ steps.artifact-name.outputs.wheel }}
container-version: v${{ steps.container.outputs.version }}
container-platforms: ${{ steps.container.outputs.platforms }}
steps:
- name: Switch to using Python 3.9 by default
uses: actions/setup-python@v2
Expand Down Expand Up @@ -204,7 +205,9 @@ jobs:
&& github.event.inputs.release-version
|| steps.scm-version.outputs.dist-version
}}' | tr + .);
echo "::set-output name=version::$VER"
PLATFORMS="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x";
echo "::set-output name=version::$VER";
echo "::set-output name=platforms::$PLATFORMS"

build:
name: 👷 dists ${{ needs.pre-setup.outputs.git-tag }}
Expand Down Expand Up @@ -727,19 +730,36 @@ jobs:
--local-executor && ./tests/integration/test_integration.sh 8899
- name: Push to GHCR
run: >-
PLATFORMS=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x;
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
CONTAINER_TAG=$REGISTRY_URL:${{
needs.pre-setup.outputs.container-version
}};
docker buildx build
--push
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
-t $CONTAINER_TAG .
- name: Tag latest on GHCR
if: >-
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
run: >-
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
LATEST_TAG=$REGISTRY_URL:latest;
docker buildx build
--push
--platform $PLATFORMS
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
-t $CONTAINER_TAG
-t $LATEST_TAG .
- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -748,14 +768,15 @@ jobs:
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Push to DockerHub
run: >-
PLATFORMS=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x;
REGISTRY_URL="abhinavsingh/proxy.py";
CONTAINER_TAG=$REGISTRY_URL:${{
needs.pre-setup.outputs.container-version
}};
docker buildx build
--push
--platform $PLATFORMS
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
Expand Down Expand Up @@ -839,35 +860,6 @@ jobs:
password: ${{ secrets.TESTPYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

# publish-docker:
# name: Publish 🐳 📦 ${{ needs.pre-setup.outputs.git-tag }} to Docker Hub
# needs:
# - check
# - pre-setup # transitive, for accessing settings
# if: >-
# fromJSON(needs.pre-setup.outputs.release-requested)
# runs-on: Ubuntu-latest

# environment:
# name: release-docker
# url: >-
# https://test.pypi.org/project/proxy.py/${{
# needs.pre-setup.outputs.dist-version
# }}

# steps:
# - name: Download all the dists
# uses: actions/download-artifact@v2
# with:
# name: python-package-distributions
# path: dist/
# - name: >-
# Publish 🐳 📦 ${{ needs.pre-setup.outputs.git-tag }} to Docker Hub
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.TESTPYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/

post-release-repo-update:
name: >-
Publish post-release Git tag
Expand Down
2 changes: 1 addition & 1 deletion benchmark/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aiohttp==3.8.1
blacksheep==1.2.1
blacksheep==1.2.2
starlette==0.17.1
tornado==6.1
uvicorn==0.16.0
28 changes: 14 additions & 14 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/js-cookie": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"chrome-devtools-frontend": "^1.0.949424",
"chrome-devtools-frontend": "^1.0.952865",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.25.3",
Expand All @@ -40,7 +40,7 @@
"http-server": "^14.0.0",
"jasmine": "^3.10.0",
"jasmine-ts": "^0.3.0",
"jquery": "^3.5.1",
"jquery": "^3.6.0",
"js-cookie": "^3.0.1",
"jsdom": "^15.2.1",
"ncp": "^2.0.0",
Expand Down
2 changes: 0 additions & 2 deletions helper/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ run_benchmark

POST_RUN_OPEN_FILES=$(./helper/monitor_open_files.sh)

echo $output

echo "Open files diff:"
diff <( echo "$PRE_RUN_OPEN_FILES" ) <( echo "$POST_RUN_OPEN_FILES" )

Expand Down
1 change: 1 addition & 0 deletions proxy/common/backports.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def randint(self):
backports
getter
Arndt
del
"""

def __init__(self, ttl: float = 0):
Expand Down
28 changes: 18 additions & 10 deletions proxy/common/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from ._compat import IS_WINDOWS # noqa: WPS436
from .plugins import Plugins
from .types import IpAddress
from .utils import bytes_, is_py2, set_open_file_limit
from .utils import bytes_, is_py2, is_threadless, set_open_file_limit
from .constants import COMMA, DEFAULT_DATA_DIRECTORY_PATH, DEFAULT_NUM_ACCEPTORS, DEFAULT_NUM_WORKERS
from .constants import DEFAULT_DEVTOOLS_WS_PATH, DEFAULT_DISABLE_HEADERS, PY2_DEPRECATION_MESSAGE
from .constants import PLUGIN_DASHBOARD, PLUGIN_DEVTOOLS_PROTOCOL, DEFAULT_MIN_COMPRESSION_LIMIT
Expand Down Expand Up @@ -186,7 +186,7 @@ def initialize(
for p in FlagParser.get_default_plugins(args)
]
requested_plugins = Plugins.resolve_plugin_flag(
args.plugins, opts.get('plugins', None),
args.plugins, opts.get('plugins'),
)
plugins = Plugins.load(
default_plugins + auth_plugins + requested_plugins,
Expand Down Expand Up @@ -340,21 +340,29 @@ def initialize(
),
)
args.timeout = cast(int, opts.get('timeout', args.timeout))
args.threadless = cast(bool, opts.get('threadless', args.threadless))
args.threaded = cast(bool, opts.get('threaded', args.threaded))
args.pid_file = cast(
Optional[str], opts.get(
'pid_file',
args.pid_file,
),
)
args.local_executor = cast(
bool,
opts.get(
'local_executor',
args.local_executor,
),
)
args.threaded = cast(bool, opts.get('threaded', args.threaded))
# Pre-evaluate threadless values based upon environment and config
#
# --threadless is now default mode of execution
# but we still have exceptions based upon OS config.
# Make sure executors are not started if is_threadless
# evaluates to False.
args.threadless = cast(bool, opts.get('threadless', args.threadless))
args.threadless = is_threadless(args.threadless, args.threaded)

args.pid_file = cast(
Optional[str], opts.get(
'pid_file',
args.pid_file,
),
)

args.proxy_py_data_dir = DEFAULT_DATA_DIRECTORY_PATH
os.makedirs(args.proxy_py_data_dir, exist_ok=True)
Expand Down
20 changes: 10 additions & 10 deletions proxy/common/pki.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,16 @@ def run_openssl_command(command: List[str], timeout: int) -> bool:
', '.join(available_actions),
)
sys.exit(1)
if args.action in ('gen_private_key', 'gen_public_key'):
if args.private_key_path is None:
logger.error('--private-key-path is required for ' + args.action)
sys.exit(1)
if args.action == 'gen_public_key':
if args.public_key_path is None:
logger.error(
'--public-key-file is required for private key generation',
)
sys.exit(1)
if args.action in ('gen_private_key', 'gen_public_key') and \
args.private_key_path is None:
logger.error('--private-key-path is required for ' + args.action)
sys.exit(1)
if args.action == 'gen_public_key' and \
args.public_key_path is None:
logger.error(
'--public-key-file is required for private key generation',
)
sys.exit(1)

# Execute
if args.action == 'gen_private_key':
Expand Down
18 changes: 12 additions & 6 deletions proxy/common/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,18 @@ def load(
mro = list(inspect.getmro(klass))
mro.reverse()
iterator = iter(mro)
while next(iterator) is not abc.ABC:
pass
base_klass = next(iterator)
if klass not in p[bytes_(base_klass.__name__)]:
p[bytes_(base_klass.__name__)].append(klass)
logger.info('Loaded plugin %s.%s', module_name, klass.__name__)
try:
while next(iterator) is not abc.ABC:
pass
base_klass = next(iterator)
if klass not in p[bytes_(base_klass.__name__)]:
p[bytes_(base_klass.__name__)].append(klass)
logger.info('Loaded plugin %s.%s', module_name, klass.__name__)
except StopIteration:
logger.warn(
'%s is NOT a valid plugin',
text_(plugin_),
)
return p

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions proxy/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def build_http_response(
headers = {}
has_content_length = False
has_transfer_encoding = False
for k in headers:
for k, _ in headers.items():
if k.lower() == b'content-length':
has_content_length = True
if k.lower() == b'transfer-encoding':
Expand All @@ -124,8 +124,8 @@ def build_http_pkt(
"""Build and returns a HTTP request or response packet."""
pkt = WHITESPACE.join(line) + CRLF
if headers is not None:
for k in headers:
pkt += build_http_header(k, headers[k]) + CRLF
for k, v in headers.items():
pkt += build_http_header(k, v) + CRLF
pkt += CRLF
if body:
pkt += body
Expand Down
25 changes: 12 additions & 13 deletions proxy/core/acceptor/acceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from typing import List, Optional, Tuple

from ...common.flag import flags
from ...common.utils import is_threadless
from ...common.logger import Logger
from ...common.backports import NonBlockingQueue
from ...common.constants import DEFAULT_LOCAL_EXECUTOR
Expand Down Expand Up @@ -113,17 +112,17 @@ def accept(
) -> List[Tuple[socket.socket, Optional[Tuple[str, int]]]]:
works = []
for _, mask in events:
if mask & selectors.EVENT_READ:
if self.sock is not None:
try:
conn, addr = self.sock.accept()
logging.debug(
'Accepting new work#{0}'.format(conn.fileno()),
)
works.append((conn, addr or None))
except BlockingIOError:
# logger.info('blocking io error')
pass
if mask & selectors.EVENT_READ and \
self.sock is not None:
try:
conn, addr = self.sock.accept()
logging.debug(
'Accepting new work#{0}'.format(conn.fileno()),
)
works.append((conn, addr or None))
except BlockingIOError:
# logger.info('blocking io error')
pass
return works

def run_once(self) -> None:
Expand Down Expand Up @@ -207,7 +206,7 @@ def _stop_local(self) -> None:

def _work(self, conn: socket.socket, addr: Optional[Tuple[str, int]]) -> None:
self._total = self._total or 0
if is_threadless(self.flags.threadless, self.flags.threaded):
if self.flags.threadless:
# Index of worker to which this work should be dispatched
# Use round-robin strategy by default.
#
Expand Down
Loading