Commit Graph

23 Commits

Author SHA1 Message Date
Abhinav Singh 5f91b179a3 Always update latest tag for docker releases 2019-10-10 15:45:57 -07:00
Abhinav Singh 3b9587b6f1
Ensure explicit flush before upgrade while TLS intercepting (#121)
* Ensure explicit flush before upgrade + nonblocking server sock.

* tls interception tests

* prepare for v1.1.1

* Add requirements.txt for typing extensions

* Add setup.py under lint workflow
2019-10-10 15:15:27 -07:00
Abhinav Singh 908c0b5855
Chrome Devtool Integration first steps (#109)
* Initialize skeleton electron app

* Attempt to open devtools

* Electron free

* Initialize public/devtools

* Add basic support for static file serving and chrome devtools.

1. No cache header management for static file serving yet.
2. No chunked encoded responses for static files yet.
3. Chrome Devtool initialization.

* Fix static serving with query params

* profile using py-spy

* Complete websocket client loop

* lint check

* Add support for building websocket frames

* Remove redundant CDT params

* Lint check

* Refactor web server base plugin name

* Devtools integrated, need more polish

* Add START_TIME global var

* lint fix

* Remove outdated chrome rdp

* Add FAQs

* Add FAQs

* socket_connection decorator + context manager

* Defer SSL handshake and plugin initialize until protocol handler thread
has started.

This is a follow up to this PR
https://github.com/abhinavsingh/proxy.py/pull/111

* Add tests for new_socket_connection and its friend socket_connection

* Address an issue which came back after being fixed in https://github.com/abhinavsingh/proxy.py/pull/92

* Lint fixes

* uff ye str and bytes

* Remove explicit flushes outside of write ready descriptor handlers

* add links to import proxy

* Only try websocket upgrade if a route is registered

* Add plugin_examples.WebServerPlugin and use precision logging for levelname

* Remove redundant comments

* Add --devtools-ws-path flag

* Add on_websocket_open and on_websocket_close callbacks

* Add empty stubs for incomplete CDT responses

* Ensure client is ready before final flush

* Shutdown on write side of socket, may be client is still reading

* Since client.closed can be set, explicitly call client.connection.closed

* Add ModifyPostDataPlugin example.

Was first asked and referenced here
https://github.com/abhinavsingh/proxy.py/issues/115

* Start adding TestHttpProxyPlugin

* Fixes #116
2019-10-09 22:36:47 -07:00
Abhinav Singh a9c8659ffa
Use selectors.DefaultSelector instead of select.select (#106)
* Use selectors.DefaultSelector instead of select.select

* Unregister to avoid endless loop

* Cleanup event register/unregiter

* Cleanup event registration

* Add google-fluentd.conf.  Use if running proxy.py on Google Cloud.

* Send server error from proxy if for whatever reason we fail to process the request (or should it be BadRequest based upon situation?)

* Fix tests for selectors

* Only include proxy.py and tests.py in coverage report

* Only include proxy.py for coverage

* remove redundant integration test, will rewrite using mocks

* Proper unregister of events

* Change multi core accept model to avoid client TIME_WAIT. Fixes #97

* Catch BlockingIOError

* Remove redundant comments

* Simplify with AcceptorPool

* Pass family to acceptor processes

* Remove plugin.access_log for core plugins

* Return 501 not implemented for web socket upgrade requests to inbuilt HTTP server

* Add support for websocket upgrade

* Websocket frame parser

* Enable websocket based routing

* Add WebsocketClient

* Websocket

* mypy fixes

* Sync GitHub workflow lint and makefile lint commands.

For now comment out tests which are broken :(  New tests coming next.

* Start fixing tests for new code

* Fix formatting

* Fix main tests

* Add worker tests

* GitHub only ran windows tests, may be require unique names

* Use 3.6/3.7 dev versions for GitHub actions

* Add AcceptorPool test

* Add x64 and x86 matrix for actions tests

* Dont use dev versions since they dont exists for x86

* Ha no x86 support itself

* Add backer link

* Remove support badge for 3.5 as it doesnt support typing

* Update read me with changed architecture notes

* Update read me with changed architecture notes

* Add `import proxy` usage instructions.

* Add pydoc reference for developers

* Put pydoc as internal documentation
2019-10-02 00:09:35 -07:00
Abhinav Singh 46bc7795fb
Bump develop version to 1.0.1 and Autopep8 (#103)
* autopep8

* add int support for text_ and bytes_
2019-09-27 15:43:35 -07:00
Abhinav Singh 032a6f26c9 Make pypi release 1.0.0 2019-09-27 13:42:53 -07:00
Abhinav Singh 292ae497fc
Test coverage and mypy compliance (#94)
* 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
2019-09-25 15:51:12 -07:00
Abhinav Singh 9e950436a7
Lint & Doc (#91)
* Remove redundant __init__ from plugins

* autopep8

* Add plugin developer and contributor guide

* Wordings
2019-09-24 22:43:29 -07:00
Abhinav Singh 92142a70d9
Add support for TLS/SSL interception and HTTPS server (#86)
* 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
2019-09-24 19:02:57 -07:00
Abhinav Singh 5bdfd20ce8
Use ipaddress type and avoid explicit Connection: close header to upstream (#76)
* Fixes #71 and address some of #75

* Fix tests as IPV6 is default now

* Add comments and raise from e
2019-09-21 19:20:27 -07:00
Abhinav Singh 5eb4d8a97c
Use Pipe instead of Queue when passing sockets (#69)
* 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
2019-09-16 20:18:14 -07:00
Abhinav Singh 8489e8bc2f Fix default listen on IPV6 for linux systems.
Closes #59
2019-09-02 11:20:26 -07:00
Abhinav Singh fcfbec4760 Add coveralls integration
No use mirrors

Enforce coverage3

Add coverage badge and use python -m to invoke coverage

Enforce pip3, remove SyntaxError reported line

Use develop branch for coverage status
2019-08-26 10:54:17 -07:00
Abhinav Singh eeb983f988 Add tests for HttpRequestRejected responses and open file limit setter. 2019-08-24 11:31:55 -07:00
Abhinav Singh 8ba63b1821 Add --version flag also used by Makefile for releases. 2019-08-24 10:23:30 -07:00
Abhinav Singh 653163532c Remove -v flag 2019-08-11 21:43:26 -07:00
Abhinav Singh 085bc2f927 Release docker container and prep for v0.4 2019-02-08 21:13:34 -08:00
Abhinav Singh 6b64c23c47 Prepare for v0.3 release 2019-02-08 18:57:44 -08:00
Abhinav Singh fcdae0e9c4 Fixes #20 HttpParser bug content-length is missing 2018-12-22 12:43:17 -08:00
Abhinav Singh 15b6fde86e Add Dockerfile and build rule 2018-12-22 07:08:04 -08:00
Abhinav Singh 917564b1d2 Fix Python3 warnings thrown while running tests
1. can't concat str to bytes
2. ResourceWarning: unclosed
2018-12-10 14:43:44 +05:30
Abhinav Singh ae0551e3fa refactor + add tests 2014-02-21 03:26:27 +05:30
Abhinav Singh 755f0e07a1 variablize reply pkt, ignore, Makefile 2013-12-24 03:21:45 +05:30