Skip to content
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

v1.0.0 Release #64

Merged
merged 86 commits into from
Sep 27, 2019
Merged

v1.0.0 Release #64

merged 86 commits into from
Sep 27, 2019

Conversation

abhinavsingh
Copy link
Owner

@abhinavsingh abhinavsingh commented Aug 26, 2019

See https://github.com/abhinavsingh/proxy.py/blob/032a6f26c94eb136c6449a438ae17d493257141e/README.md for full list of changes.

Since core APIs have changed vastly, we'll skip v0.4 and jump to v1.0. With proxy.py v1.0 is now more scalable and performant (utilizes multi-core) as well as now supports customizations via plugins.

  1. Python3 only, deprecation for Python2.7 support.
  2. Travis integration for cross-platform testing macOS, Linux, Windows
  3. Core API changes, it's now a framework.
  • HttpProtocolHandler now implements base Http RFC. It supports core plugins for custom handling of incoming Http Client requests.
  • Implement HttpProtocolBasePlugin to add your own custom request handling, however in most case you probably simply want to implement HttpProxyBasePlugin (see below)
  • HttpProxyPlugin and HttpWebServerPlugin internal plugins now provide core logic on top of core APIs. They themselves support their own plugin system :). Yes its a pluggable framework.
  • Core TcpServer now pre-spawns N worker processes to handle incoming client requests. This ensures utilization across CPU cores. N == Number of CPU cores
  1. HttpProxyPlugin itself supports plugin. Implement HttpProxyBasePlugin to customize proxy request behavior. See plugins_examples.py for a few implementations.
  2. HttpWebServerPlugin too supports plugin. Patch your method with HttpWebServerBasePlugin.route or implement HttpWebServerBasePlugin to customize http web server behavior.
  3. New flags in v1.0:
  • --disable-headers: List of comma separated headers which should be dropped before dispatching client request to upstream server.
  • --pac-file PAC_FILE: A file (Proxy Auto Configuration) or string to serve when the server receives a direct file request. See proxy.pac for a sample PAC configuration.
  • --pac-file-url-path PAC_FILE_URL_PATH: Web server path to serve the PAC file.
  • --pid-file PID_FILE: Default: None. Save parent process ID to a file.
  • --plugins PLUGINS: Comma separated plugins. Example --plugins plugin_examples. SaveHttpResponses
  • --enable-http-proxy: Default: True. Whether to enable proxy.HttpProxyPlugin.
  • --enable-web-server: Default: False. Whether to enable proxy.HttpWebServerPlugin.
  • --log-level LOG_LEVEL:
    Valid options: DEBUG, INFO (default), WARNING, ERROR,
    CRITICAL. Both upper and lowercase values are
    allowed.You may also simply use the leading character
    e.g. --log-level d
  • --log-file LOG_FILE: Default: sys.stdout. Log file destination.
  • --log-format LOG_FORMAT: Log format for Python logger.
  • --version: Prints proxy.py version.

pbi-qfs and others added 30 commits January 16, 2019 12:43
Add header "Proxy-Authenticate" into 407 response.
Added --pac-file option to serve a Proxy Autoconfig file
Use `--ipv4 1` to only listen on IPv4. Fixes #48
Default listen on IPv6 now.
Pre-spawn worker processes to utilize all cores.
This can be an issue with pipelining, but ideally should also be
assisted by time-to-live logic.  Currently, we drop connection if it is
idle for more than max allowed idle time.
1. Update class name to be more verbose
2. Update docstring for important classes
3. Global default constants
Some users are already being effected by this, however master branch is
still stable.  Python 2.7 users can continue using the master branch or
simply install via pip.  This change also targets issue#58
abhinavsingh and others added 27 commits September 13, 2019 11:03
Unfortunately collections.namedtuple isn't supported by mypy and most
likely never will be. Idea will be to use Typing.NamedTuple but this
require some code refactoring.
* Use pipes instead of queues.

Possible solution for #68

* Handle ConnectionRefusedError

* Close corresponding pipes on shutdown

* Abstract classes for plugins.

* Add github workflows

* Use pytest for github workflow

* Add Windows/Mac workflows

* Use os.matrix

* 3.8 and 3.9 probably dont exists yet

* Do not fail-fast, also python 3.5 seems to be throwing syntax error for typing

* autopep8

* Disable windows-latest workflow which seems to hang
* Fix HttpParser to correctly reach COMPLETE state.

Fixes #70, see test case test_pip_connect

* Remove redundant logic.

* Lint fixes
* Update coverage from 4.5.2 to 4.5.4

* Update twine from 1.12.1 to 1.15.0

* Update pytest from 5.1.2 to 5.1.3
…tream (#76)

* Fixes #71 and address some of #75

* Fix tests as IPV6 is default now

* Add comments and raise from e
* Resolve issues reported by Bandit

* Fix tests
* mypy coverage

* First stab at mypy --strict complaince

* mypy --strict compliance.

* Run mypy during Quality Check phase
* Make docker v1.0.0 release

* 👍

* 👍 📱 💻 💡

* 👍 📱 💻 💡
* Can serve proxy traffic over HTTPS.

Pass --certfile and --keyfile arguments to enable SSL/TLS layer.
Example:

1) Start proxy.py as

./proxy.py --certfile cert.pem --keyfile key.pem

2) Then verify via curl

curl -v -x https://localhost:8899 --proxy-cacert cert.pem http://httpbin.org/get

* Add --ignore-missing-imports for missing multiprocessing.reduction module

* mock socket.fromfd to avoid sys calls

* Add HTTPS info

* Add TLS encryption

* Add TLS encryption
* Handle OSError thrown when curl --proxy-cacert flag is invalid

* Add server-cert

* Dockerfile dont need --ipv4 since now its auto-detected and deprecated

* Add make server-cert info

* Add support for HTTPS interception.

1) Start as

    proxy.py --ca-key-file ca-key.pem --ca-cert-file ca-cert.pem --ca-signing-key-file ca-signing-key.pem

2) Test using curl

    curl -v -L -x proxy.py:8899 --cacert ca-cert.pem https://google.com

Now proxy.py is able to decrypt HTTPS traffic between curl and
google.com.  Generated certificates are stored under ~/.proxy.py
directory.

* Add comments for why interception do not work if client is communicating with proxy.py over https

* Fix tests

* Exit with message when trying to https intercept and also serve over https

* lint

* Disable OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_TLSv1, OP_NO_TLSv1_1 when wrapping upstream server socket

* Ensure client.conn.shutdown is called if necessary.

* Add mypy check for plugin_examples.py

* Exception handling when client sends invalid requests

* Verify plugin_examples

* mypy compat

* HttpRequestRejected
* Add documentation

* Add TOC

* Add links to encryption and tls

* fix cert-file and key-file

* Add example for verification of https and tls interception

* Bigger fonts

* Redact
* Remove redundant __init__ from plugins

* autopep8

* Add plugin developer and contributor guide

* Wordings
* Add tests and mypy compliance for tests

* Add pragma: no cover for abstract class methods

* mypy --strict compliance for tests.py

* Refactor and test coverage

* lint fixes
* Enable windows and pre/dev python releases

* Move twine to requirements-release.txt

* 3.5 do not support type annotations

* Use inbuild build_request, build_response methods now.

* First cut of web server route plugin architecture

* Add route decorator

* mypy

* disable TestMultiCoreRequestDispatcherIntegration for github

* Anyways it doesnt format as advertised
* Always deduce address family as we have a structure

* Convert TcpConnection into an ABC.

* Fix tests

* Rename MultiCoreRequestDispatcher to WorkerPool

* Consistent naming refactor

* Make WorkerPool independent of protocol config object

* Fix tests

* Proper fix for test_on_client_connection_called_on_teardown

* TLS interception

* better logging
* Add ProposedRestApiPlugin example.

This plugin is an example to demonstrate how `proxy.py` can help you
test and debug client applications without actually having a need of
backend server.

Simply modify ProposedRestApiPlugin as per need to return json
responses for your API specs.

* Add README instructions

* Correct username
@abhinavsingh abhinavsingh merged commit b34c720 into master Sep 27, 2019
@abhinavsingh abhinavsingh changed the title v0.3 -> v1.0 v1.0 Release Oct 10, 2019
@abhinavsingh abhinavsingh changed the title v1.0 Release v1.0.0 Release Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants