Commit Graph

161 Commits

Author SHA1 Message Date
Abhinav Singh 50046d3f68
TLS intercept self-signed servers using `--insecure-tls-interception` (#1446)
* Disable mandatory TLS verification with --insecure

* Fix lint issues

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix type issues with `cert_der_to_dict`

* Flake8 exception

* Fix `cert_der_to_dict` where file may not be writter before it is gets used by `_test_decode_cert`

* Silence lint issue due to pylint bug

* Rename flag to `--insecure-tls-interception`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Reuse `DEFAULT_SSL_CONTEXT_OPTIONS`

* # noqa: WPS436

---------

Co-authored-by: d4x <d_4xfe@proton.me>
Co-authored-by: d4xfe <168460626+d4xfe@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-10 12:12:55 +05:30
Abhinav Singh 1e4e87d515
Support for Python 3.12 (#1444)
* Support for Python 3.12

* Use `assert_called_once_with` and not `called_once_with`

* lint fix

* Fix `test_pac_file_served_from_disk`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-10 09:33:49 +05:30
Abhinav Singh 201d02ce72
Deprecate usage of `ssl.wrap_socket` in favour of `SSLContext.wrap_socket` (#1443)
* Remove use of ssl.wrap_socket

ssl.wrap_socket() has been deprecated since Python 3.7, and isn't
recommended for use, and further, has been removed in Python 3.12.
ssl.SSLContext().wrap_socket() is the new path forward, so switch the
one callsite and the two test cases to use it instead.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix `SSLContext.wrap_socket` params and reusable `DEFAULT_SSL_CONTEXT_OPTIONS`

* Fix test cases

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix e2e tests???

---------

Co-authored-by: Steve Kowalik <steven@wedontsleep.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-09 23:45:17 +05:30
Abhinav Singh 81aa82b9a4
SSH handler/listener plugins (#1398)
* SSH handler/listener plugins

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Readme updated

* Fix listener tests

* pyclassrole

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Trigger rebuild

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Trigger build

* pre-commit default language version 3.10

* Language version

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-24 15:13:14 +05:30
Abhinav Singh c24862ba85
Ability to override `--data-dir` for scenarios when `proxy.py` is running as a user with no home directory (#1389)
* Ability to override `--data-dir` for scenarios when `proxy.py` is running as a user with no home directory

* Single quotes

* Update expected tar.gz name and Default to `ms-python.black-formatter` in vscode settings

* Fix tests for Python 3.6 and 3.7

* Updated README
2024-04-18 09:04:07 +05:30
Abhinav Singh 2fa320d03f
Python 3.11 support (#1384)
* Changes for Python 3.11 support

* Updated README.md for versioning info

* Update `httpx==0.27.0` to avoid `cgi` deprecation warning from pytest on Python 3.11

* Make tests work for 3.11

* Declare support for 3.11

* Use 3.11-alpine for Docker images

* Preserve pylint version for `python_version <= 3.10`

* Preserve httpx version for <= 3.10

* `httpx` usage fix in tests for <=3.10

* Adjust pylint and pytest for >= 3.11

* Use 3.11.8, bad-option-value and httpx proxies fix

* tox for 3.11

* Fix for `TOXENV: py`

* -vv for pytest

* Downgrade to `pytest-asyncio==0.21.1`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove asyncio_mode=strict

* try with `pytest-cov==4.1.0` for 3.11

* bump coverage for 3.11

* Try `3.11` in GitHub workflow which installs >3.11.8 unavailable via pyenv yet

* Revert back to `-v`

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-13 13:22:25 +05:30
dongfangtianyu 81510a0cec
FIX proxy authentication bypass with HTTP/1.0 requests #1267 (#1342)
* test: Add test case to reproduce bug #1267

* fix: Bypass proxy authentication with HTTP/1.0 requests #1267

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com>
2024-04-12 08:16:14 +05:30
Abhinav Singh ddc96d4c09
Update project test dependencies to ensure green workflow (#1371)
* Use www.google.com for http2 tests

* Update README.md

Add missing tutorial's link

(cherry picked from commit e459f932cd)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* System packages for readthedocs

* Pin pyyaml, see https://github.com/yaml/pyyaml/issues/724\#issuecomment-1638587228

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Ignore flake8 S507

* precommit `pyyaml==5.3.1`

* follow https://github.com/yaml/pyyaml/issues/724

* pin to essentials_openapi==0.1.4 for blacksheep

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove blacksheep dep

* remove system_packages

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Check if tox upgrade helps with `ERROR: FAIL could not package project ` tox related issues

* Fix links

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use `importlib.metadata` instead of `pkg_resources`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Just remove link from plugin docstring for now

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* pin `sphinxcontrib-applehelp==1.0.2` which is breaking spellcheck

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Pin `sphinxcontrib-*`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* pin `towncrier` too

* add kwargs as a spelling

* `_get_dist` backward compatible with 3.6

* Use `httpbingo.org` instead of `httpbin.org` in tests making network requests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use `httpbingo` for reverse proxy plugin too which is tested in workflows

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* `importlib-metadata; python_version <= 3.7`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Integration test changes due to usage of httpbingo instead of httpbin

* `importlib-metadata; python_version <= 3.7` moved to build essentials and bypass reverse proxy integration test result verification for now

* Filter and ignore `DeprecationWarning` to make it work on 3.7

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* with deprecation ignore we dont need `importlib-metadata`

---------

Co-authored-by: Wermeille Bastien <bastien.wermeille@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-11 13:04:10 +05:30
Alexey Pelykh 30574fd041
Support --hostnames (#1325)
* Support --hostnames

* Support python binaries that are not called "python"

* Update log statement to use self.hostname now

---------

Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com>
2023-04-17 09:42:18 +05:30
Alexey Pelykh f3d19ff9d7
Support plugins defined as inner classes (#1318)
* Support plugins defined as inner classes

* Prefer __qualname__ over __name__ for classes

---------

Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com>
2023-03-14 20:00:07 +05:30
Abhinav Singh 93f6fd63e4
Add timeout to requests (#1321) 2023-03-14 17:24:34 +05:30
Abhinav Singh bb8f8bee2f
Use only a single acceptor in tests to avoid Windows pitfalls (#1199)
* Use only a single acceptor in tests to avoid Windows pitfalls

* Revert `timeout=1`, likely single acceptor on Windows during tests on GHA is the escape route
2022-06-16 02:42:21 +05:30
Abhinav Singh 315cd17fbd
Add `timeout=1` when joining acceptors (#1196)
* Add a context manager test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* `IS_WINDOWS` must also be True for cygwin environments.  Addresses #1169

* Give an acceptor join timeout of 10 seconds instead of None

* Reduce timeout to just 1 sec

* Install necessary types (requests is translative dep)

* Remove conflicting types

* Give precommit the necessary type

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-15 23:48:20 +05:30
Abhinav Singh 69f8b548ee
Allow multiport with ephemeral & unix socket support (#1078)
* Allow multiport with ephemeral & unix socket support

* Fix unix tests
2022-01-31 01:56:34 +05:30
Abhinav Singh bc577f348b
Add `--cache-by-content-type` flag (#1070)
Add `--cache-by-content-type` flag
2022-01-27 05:04:54 +05:30
Abhinav Singh 3fd608eb72
[Jupyter] Request creation notebook (#1065)
* Add plugin tests, responses notebook and enhancements to `build_http_packet`

* Add js code snip for ws example

* Fix tests

* ignore all ipynb from codespell

* ignore all ipynb from codespell

* Fix tests and doc spell
2022-01-26 19:50:12 +05:30
Abhinav Singh fd6d1b36ef
[HttpParser] Memory view compliant, Zero copies (#1067)
* Remove usage of `tobytes`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix chunk parser

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Lint fixes

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-26 18:58:37 +05:30
Abhinav Singh f48aac4523
[Optimize] Avoid using `tobytes` for zero-copies (#1066)
* Avoid using `tobytes` where possible

* `send` accepts `Union[memoryview, bytes]` now

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-26 17:42:32 +05:30
Abhinav Singh 600b3e7c21
[Jupyter] Add a response notebook (#1064)
* Add a response generation jupyter notebook

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Make codespell happy

* precommit codespell exclude

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-26 15:28:27 +05:30
Abhinav Singh 32a0759f96
[Fix] Using `okResponse()` without content hangs the connection (#1062)
* It hangs because of no content-length or connection close header

* Fix tests
2022-01-26 14:40:38 +05:30
Abhinav Singh f084342296
`jupyter` notebook based tutorial (#1059)
* `jupyter` notebook based tutorial

* Move within `tutorial` directory

* Fix spell

* Add `as_non_blocking` option during wrap

* `as_non_blocking=False` by defaut
2022-01-25 19:26:18 +05:30
Abhinav Singh d616fc87db
[CacheResponsesPlugin] Add ability to cache request packets (#1056)
* Start of post encryption tests

* Assertion on post encryption callback

* Add `--cache-requests` flag

* Clean up `on_client_data` API as we no longer have a chain within core http protocol handler

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix flake8 warnings

* Fix `inconsistent-return-statements`

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-24 23:38:57 +05:30
Abhinav Singh ac183f5242
[Core] Invoke selector.close on shutdown (#1055)
[Core] Invoke `selector.close` on shutdown
2022-01-24 19:20:17 +05:30
Abhinav Singh d1920460d0
Pre `v2.4.0rc8` cleanups (#1053)
* Pre-release cleanups

* Add listener pool test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add multi listener test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-24 11:36:51 +05:30
Abhinav Singh 2bebbacbd3
[Work] `kwargs` independent `work_klass` creation and work core (#1051)
* `kwargs` independent work klass and core

* Fix tests

* Add a `create` method to base class

* Lint fixes
2022-01-24 03:16:08 +05:30
Abhinav Singh c3b06f121b
[Work] Refactor as FD work (#1049)
* Abstract out FD based work implementation

* No need of local/remote abstractions

* fix type

* Add `BaseLocalExecutor`

* Fix lint and tests
2022-01-24 01:38:36 +05:30
Abhinav Singh ac840aec78
[Work] Refactor for generic work type (#1048)
* Add `TcpOrTlsSocket` type

* isort

* Update to use Fd executor

* Define `HostPort` type

* Fix fileno

* spellfix
2022-01-23 23:20:04 +05:30
Abhinav Singh d7a568e7fd
[CacheByContentTypePlugin] Prepare for content type parsing (#1038)
* Move default cache directory within `proxy.py` instance data directory

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add `CacheByContentTypePlugin` skeleton and remove unnecessary mixin

* Fix startup issues after removal of mixin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* .

* Fix broken mock

* doc fix

* doc

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-23 18:05:51 +05:30
Abhinav Singh 7845cbb28d
[SOCKS4] Packet parser & builder (#1047)
* Initial commit

* Parse socks4 packet

* Lint check

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix lint issues

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add handler test skeleton

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-23 16:57:58 +05:30
Abhinav Singh 25e6cb0fe5
[ReverseProxy] Add integration tests (#1037)
* Add reverse proxy integration test

* Fix reverse proxy url for https integration

* Enable reverse proxy for docker build and test
2022-01-22 19:41:02 +05:30
Abhinav Singh 67d9066cfc
[Multiport] `Acceptor` can now accept work from multiple descriptors (#1036)
* Update acceptor to accept work from multiple ports

* import order

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix acceptor tests

* Tweak

* fix tests

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-22 18:54:27 +05:30
Abhinav Singh cc126c3476
[Multiport] Prepare for listening on multiple ports (#1031)
* Convert `--port` to list of integers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Prepare for multiport listener

* Multi listeners, but will fail in theory as no port override is currently performed

* Separate `listener` module

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update flags in readme

* Fix imports in listener test

* Fix flag parsing for `port` and `ports`

* Fix tests

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-22 15:53:36 +05:30
Abhinav Singh 1569146d70
[ReverseProxy] Move within core lib with ability to write its plugin (#1033)
* Move reverse proxy core within core lib

* Fix main test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix doc and lint

* Fix lint

* Top level category for reverse plugin

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-21 22:29:34 +05:30
Abhinav Singh f5bf5b9714
Move `Tls` module within core (#1030) 2022-01-21 15:21:11 +05:30
Abhinav Singh 627b42f923
Handle `SIGINFO`. Try `kill -s INFO <pid>`. (#1024)
* Handle `SIGINFO`.  Try `kill -s INFO <pid>`.

Also remove dirty hack added in flags to incorporate `--basic-auth`
flag.  Add `__pycache__` to ignore list.  Disable http proxy
during acceptor benchmark.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* not on windows

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* no cover

* # pylint: disable=E1101

* Curl retry on error and check_output 2 minute timeout

* check output timeout None

* Update `faulthandler_timeout` to 2 minutes

* Disable `test_circular_imports`, `isort` integration now works

* Fix curl flags

* Revert back to older flags

* SIGINFO attribute might not even exist

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-20 23:54:44 +05:30
Abhinav Singh 85ad44b46e
[Windows] Remove `--threadless` from `TestCase` (#1025)
[Windows] Remove `--threadless` from `TestCase`
2022-01-20 20:58:42 +05:30
Abhinav Singh 54e74a911f
[isort] Lib modules (#1016)
* isort `proxy.py` main class

* isort init and main

* isort common

* pre-commit fix

* isort dashboard and testing

* isort plugins

* isort core

* Only sort top level http py files

* isort http exception and websocket

* Remove proxy auth plugin from proxy package exports and force discover `PLUGIN_PROXY_AUTH` flags

* isort parser and web server

* no setattr

* isort all

* Enable pre-commit isort hook

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-20 15:34:54 +05:30
Abhinav Singh 7beef281c6
[Coverage] For newly added components (#1014)
* Add newly added code cov

* Fix spelling
2022-01-20 11:45:29 +05:30
Abhinav Singh efd1cac3ea
Restrict request handling to `DEFAULT_ALLOWED_URL_SCHEMES` (#1002)
* Raise `HttpProtocolException` if request line scheme do not match `DEFAULT_ALLOWED_URL_SCHEMES`

* ignore WPS329

* Fix tests

* Pin to 4.3.2

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Test coverage for exception handling

* type ignore

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-19 19:20:19 +05:30
Sowmya Sudha Singh d046cea71c
[Windows] `--threaded` mode integration tests works locally but fails on GHA (#1009)
* Enable remote threadless and threaded integration test for windows

* Run only threaded on windows

* Use powershell for execution of integration script on Windows

* Update test_integration.py

* Update test_integration.py

Co-authored-by: sowmyasudhasingh <sowmyasudhasingh@gmail.com>
Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com>
2022-01-19 18:51:27 +05:30
Abhinav Singh 21499ad1cb
Bail out early for non-HTTP but HTTP looking protocols (#972)
* Add support in `Url` to parse all types of schemes

* .

* Guard handler against http looking protocol but not web or proxy requests

* Fix condition for web server protocol detection

* doc happy

* Update flags and type check imports only
2022-01-18 00:11:48 +05:30
Abhinav Singh 552fb998df
[Middleware] `HttpClientConnection` preparation (#995)
* Turn usual suspects to warnings, not error

* Add `HttpClientConnection` skeleton

* Fix doc build

* Update references in http tests

* Make `work` core agnostic to work object construction by adding an abstract static method to `Work` interface called `create`

* Make mypy happy

* Fix tests broken due to change in how work objects are now constructed

* Doc ko bhi happy karo
2022-01-16 18:34:33 +05:30
Abhinav Singh c6fceb639a
[Middleware] Capability in the core to allow custom client connection classes (#993)
* Move all TCP server related flags within `tcp_server.py` and also move the encryption functionality within TCP base server

* Templatize `BaseTcpServerHandler` which now expects a client connection object bound to `TcpClientConnection`.  This will allow for custom `HttpClientConnection` object in future to be used by `HttpProtocolHandler`

* Pass necessary flags to allow self-signed certificates

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix https integration tests

* Affected by https://github.com/abhinavsingh/proxy.py/issues/994

* Fix docs

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-16 03:22:55 +05:30
Abhinav Singh d17dc9e448
[SshTunnel] WIP (#992)
[SshTunnel] WIP
2022-01-16 00:22:34 +05:30
Abhinav Singh 0ffa7ca9fb
[TlsInterception] Fix broken `ChunkedResponsePlugin` for `Python < 3.10` (#986)
* Add TLS interception integration tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix CI

* unused

* Well 3.9 just worked locally

* Dispatching empty byte to client results in OSError for Python < 3.10

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Uncomment old integration tests

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-14 14:35:28 +05:30
Abhinav Singh 2714d3d22a
Pass separate `--ca-cert-dir` flag for parallel TLS interception tests (#984)
* Pass separate `--ca-cert-dir` flag for parallel TLS interception tests

* Temp disable `test_modify_post_response_integration`

* mock ca cert dir

* Is threaded an issue with TLS interception?

* Disable modify chunk response for python < 3.10

* Disable modify chunk response for python < 3.10
2022-01-14 12:02:17 +05:30
Abhinav Singh 8a28910224
[TlsInterception] GHA integration tests (#981)
* Add TLS interception integration tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixture to gen certificate once for the `test_integration` module

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use https endpoints in tls interception tests

* Fix modify post data integration test

* Only start 3 acceptor & 3 workers during integration run

* disable chunk response

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-14 00:08:12 +05:30
Abhinav Singh dd2476f02a
Refactor into separate `Work` module (#977)
* work module

* Fix imports

* String based typing for multiprocessing.synchronize

* Fix `test_accepts_client_from_server_socket`

* Move staticmethod outside of threadless pool class

* Fix doc build

* Fix test mock

* mp grouped together

* pylint happy

* import only for type checking

* doc build

* wrong import order
2022-01-13 16:07:51 +05:30
Abhinav Singh 05a8ff9fe7
Test submodule and refactor (#971)
* Refactor tests into submodules

* isort tests

* Add malicious request headers test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-13 00:36:37 +05:30
Abhinav Singh 01bfc7dc30
[HttpProtocolHandler] Handle invalid request parsing exceptions (#957)
* Handle invalid request parsing exception when raised, log the bytes for later inspection

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-11 02:27:19 +05:30