Commit Graph

69 Commits

Author SHA1 Message Date
Abhinav Singh 864a0b8f5f
Fix mypy errors (#504) 2021-02-21 16:33:34 +05:30
Abhinav Singh bff171ec26
Fix basic auth condition (#482)
* Fix basic auth condition

* Prepare for v2.3.1
2021-01-10 22:12:56 +05:30
Abhinav Singh 4520ae31a6
Refactor base server interfaces into core modules (#461)
* Ensure pending buffers are flushed before shutting down in base_server.py

Handle unsupported scheme cases within connect_tunnel.py

* Move base implementations within core module

* Update ssl_echo_server
2020-11-24 21:37:11 +05:30
Abhinav Singh f04845cd64
Refactor (#456) 2020-10-15 19:05:37 +05:30
Abhinav Singh 137ce457bb
Separate basic auth plugin outside of core server (#453)
* Separate basic auth plugin outside of core

* Put basic auth plugin at top
2020-10-14 20:00:29 +05:30
Abhinav Singh 0744cd8e7f
Go flagless to allow custom user defined flags. (#452)
* Go flagless to allow custom user defined flags. Fixes #301

* Add --cache-dir flag for cache plugin (when used with on-disk store)

* Enable discovery of flags from external plugins, example those that reside outside of proxy.py package and loaded on demand.  This also allows external flags to surface in --help section

* Define --filtered-client-ips flag for FilterByClientIpPlugin
2020-10-14 10:51:56 +05:30
Abhinav Singh a48319e32d
Relax proxy auth requirement to allow mixed case for the auth type e.g. "basic", "Basic", "BaSiC" are all allowed (#451) 2020-10-13 20:56:23 +05:30
Abhinav Singh 969990464c
Fix path to devtools websocket endpoint, broken after refactoring (#450) 2020-10-11 10:26:36 +05:30
Abhinav Singh 4804c534f8
Update mypy (#449) 2020-10-10 16:23:29 +05:30
Abhinav Singh 1038bb841d
More examples (#444)
* Refactor into BaseServerHandler and BaseEchoServerHandler classes

* Add connect tunnel example
2020-10-06 22:27:19 +05:30
Abhinav Singh 8cc349be48
Allow plugins to add custom command line flags (#438)
* Allow plugins to add custom command line flags.  Addresses #301

* Reduce dependency over Flags class.  This will be deprecated so that adhoc flags can be added without any additional manual configuration

* Fix: Argument 1 to "mock_default_args" of "TestMain" has incompatible type "Namespace"; expected "Mock"

* Reduce Flags class to just the initializer.

* Store list of action dest in FlagParser
2020-10-03 16:25:43 +05:30
Pascal COMBES e3a1b7f963 Ensure plugins are loaded only once.
Also changed module name for plugins passed by type.
2020-08-11 22:14:51 +02:00
Pascal COMBES 1b8d9a8e67 Pass a list plugin class objects or bytes to proxy when used in embeded mode.
No automated tests for the feature yet.
2020-08-11 16:28:32 +02:00
Pascal COMBES 929800200e Remove test for 'HttpWebServerRouteHandler'
This does not exist (as fas as I can see) and it bother the linter (Mypy),
when I tell it `klass` is a `type` instance.
2020-08-11 16:12:28 +02:00
Mike aedf5933f2
Add plugin "FilterByURLRegexPlugin" (#397)
* Initial draft of filter_by_url_regex.py

* Add FilterByURLRegexPlugin

* Fix dictionary key & add logging

* Add proper logging

* Add better logging

* Add logging

* move code to handle_client_request

* development logging

* development

* development

* development

* dev

* dev

* dev

* dev

* dev

* dev

* dev

* dev

* dev

* dev

* dev

* Fix blocked log

* Add to FILTER_LIST, some tidy up

* Update FILTER_LIST

* dev

* remove scheme from url

* Add to FILTER_LIST

* Add to FILTER_LIST

* Update FILTER_LIST

* commenting

* Update FILTER_LIST

* After autopep8

* Fix Anomalous backslash in string (pep8)

* Address code quality checks - flake8 F401 & W605

* Address flake8 errors

* Attempt to fix flake8 errors

* Fix linting issues

* Address flake8 W292

* Attempt to create tests

* Add FilterByURLRegexPlugin

* Rename test

* Work on tests

* Work on tests

* Work on tests

Co-authored-by: Abhinav Singh <mailsforabhinav@gmail.com>
2020-07-13 10:40:34 +05:30
Abhinav Singh 1867d58338
Add cross ref for how to generate SSL certs. (#401) 2020-07-12 21:24:20 +05:30
Abhinav Singh 73bcf1d057
Add core pubsub eventing example and add menubar item skeleton (#396)
* Initialize menu bar items with click handler and open a popover for preferences

* Add Core PubSub eventing example

* Remove hardcoded request ids
2020-07-09 21:31:29 +05:30
Abhinav Singh b7c4c5f175
Add SSL echo server & client example (#395)
* Move wrap_socket for SSL server within utils.

Also complete proxy.common.pki gen_csr and sign_csr actions. Used by Makefile sign-https-certificates.

* Add SSL echo server and client example

* Add examples documentation
2020-07-08 16:38:58 +05:30
Abhinav Singh 682114e9e0
Decouple SSL wrap logic into connection classes (#394)
* Move wrap functionality within respective connection classes. Also decouple websocket client handshake method

* Add a TCP echo client example that works with TCP echo server example
2020-07-08 13:11:12 +05:30
Abhinav Singh c884338f42
Core acceptor pool doc, cleanup and standalone example (#393)
* Better document acceptor module and add a TCP Echo Server example

* autopep8 formating

* Rename ThreadlessWork --> Work class

* Make initialize, is_inactive and shutdown as optional interface methods.

Also introduce Readables & Writables custom types.

* Move websocket code into its own module

* Add websocket client example

* Cleanup websocket client
2020-07-07 18:01:49 +05:30
Abhinav Singh 1b0ed923d7
Refactor plugin base classes for plugin specific flags (#388)
* Update to latest code signing recommendations

* Move HttpProtocolHandlerPlugin into separate file

* Dont add subject attributes if not provided by upstream. Also handle subprocess.TimeoutExpired raised during certificate generation.  Instead of retries, we simply close the connection on timeout

* Remove plugin specific flag initialization methods for now
2020-07-04 18:17:11 +05:30
Abhinav Singh ea227b1cdf
Document FilterByClientIpPlugin & ModifyChunkResponsePlugin (#387) 2020-07-02 03:30:29 +05:30
Abhinav Singh 4117c5f0d5
Add FilterByClientIpPlugin example (#381) 2020-06-21 21:57:03 +05:30
Abhinav Singh 62012ed181
Enable docker containers for TLS Interception (#375)
* Move static values to constants.py

* Install openssl in docker containers for TLS interception

* Complete TLS Interception with Docker doc
2020-06-17 17:54:43 +05:30
Abhinav Singh 1b2966140c
Copy certificate subject from peercertificate, use ssl.PROTOCOL_TLSv1_2 for client wrap and allow TLSv1_1 for server wrap (#370) 2020-06-13 21:42:12 +05:30
Abhinav Singh d6e60774ae
Add DEFAULT_MAX_SEND_SIZE and handle SSLWantWriteError errors when dispatching to upstream servers (#368) 2020-06-13 16:05:01 +05:30
Abhinav Singh 14fda0c95a
Fixes #356 WebSockets not working with TLS interception (#365) 2020-06-11 22:45:09 +05:30
Abhinav Singh e7aa8a28f7
TLS Interception Cert Generation (#362)
* Use common.pki for interception certificate generation

* Fix tests

* Dont use certificate fields that we dont need, it leads to certificate generation error on Ubuntu

* Prepare for v2.2.0

* npm audit fix
2020-06-09 12:07:00 +05:30
Abhinav Singh 7a67d0ffe4
urlsplit compliance for https CONNECT (#360)
* Add fix to be complaint with urlparse.urlsplit semantics which expects a fully qualified URL

* Log exception stacktrace on OSError
2020-06-06 19:10:41 +05:30
Abhinav Singh 08824869c2
Fix & Re-enable VCR testing on Linux (#323)
* Fix/Re-enable VCR test on Linux

* Disable tests for Windows due to weird permission issues
2020-03-26 12:31:00 +05:30
Abhinav Singh ab1198268c
Add flag to specify custom system CA Path (#321)
* Fixes #320

* Update README and add codecov.yml

* Update codecov.yml
2020-03-25 13:30:19 +05:30
Abhinav Singh bb736aa4a0
Remove -dev from python-version (#287)
* Remove -dev from python-version. See https://twitter.com/imoracle/status/1224070108064043008 for background

* Remove benchmark module which was broken on 3.6.9 (mypy broken). Also remove 3.5 support from README
2020-02-02 13:05:06 -08:00
pva 27e3cadf03
Fix ProxyPoolPlugin.rebuild_original_path 2020-02-01 10:16:19 -08:00
Bénouare 12de12d2a7
(#258) Fix generation of certif -> chg Time.time() to self.uid.int (#258)
Co-authored-by: Abhinav Singh <mailsforabhinav@gmail.com>
2020-02-01 08:51:25 -08:00
Abhinav Singh 434e2502ec
Add urlparse fix for Python 3.6.x . Deprecate support for Python 3.5.x (#278)
* Add fix required to run on Python 3.6.  Python 3.5.x is no longer supported as it reports syntax error and no longer recognize typing syntax

* Prepare for v2.1.2
2020-01-30 22:35:41 -08:00
Abhinav Singh 87a54a0781
Fixes #267 (#277)
* Fixes #267

* Prepare for v2.1.1
2020-01-30 21:54:02 -08:00
Abhinav Singh 6740b2857a
Refactor into event submodule (#257) 2020-01-07 11:38:25 -08:00
Abhinav Singh ee4e4ce41e
Add py.typed marker, add version checker, remove deprecated methods (#255)
* Add py.typed marker

* Add version-check.py

* Remove deprecated assertDictContainsSubset usage
2020-01-06 21:23:38 -08:00
Abhinav Singh ac29e34137
Add CLI usage for pki.py and update Makefile (#254)
* Add CLI usage for pki.py

* Bump to 2.1.0

* Replace direct openssl invocation with pki utility

* Bolder

* Ordering and version in README

* Refine help
2020-01-06 19:51:18 -08:00
Abhinav Singh 63e6d22566
Optionally initialize manager in main thread and use the same for EventQueue initialization (#239) 2019-12-20 17:10:35 -08:00
Abhinav Singh c6c09395f9
Share lock to acceptors via pool (#238)
* Move manager initialization outside of top level scope.  Fixes #233

* Share lock to acceptor via pool
2019-12-20 15:13:46 -08:00
Abhinav Singh 625dc4d3e5
Move manager initialization outside of top level scope. Fixes #233 (#236) 2019-12-20 14:01:26 -08:00
Abhinav Singh ba5c84dfbd
Proxy Pool Plugin (#228)
* Add proxy pool example. See #226

* Add ProxyPoolPlugin to doc
2019-12-09 19:38:49 -08:00
Abhinav Singh ccaf868921
Response parser now reaches COMPLETE even when no body is expected (#220)
* Stash current changes

* Refactor into connection module

* Response parser state complete when no body expect

* Raise NotImplementedError if invalid state reached within parser
2019-12-02 19:18:43 -08:00
Abhinav Singh 269484df2e
Make HTTP handler constructor free of socket file number (#219)
* Refactor into acceptor module

* Add tunnel doc

* Make fileno free

* Autopep8
2019-12-02 15:55:08 -08:00
Abhinav Singh 5e714374af
Handle ETIMEDOUT, EHOSTUNREACH, ECONNRESET on no internet (#216)
* Catch TimeoutError and OSError (host unreachable)

* Handle ETIMEDOUT, EHOSTUNREACH, ECONNRESET
2019-12-02 00:08:15 -08:00
Abhinav Singh 6137fd6f82
Refactor (#213)
* Add DEFAULT_HTTP_PORT constant

* Use DEFAULT_HTTP_PORT in tests

* Refactor into exception module

* Refactor into inspector module

* Refactor into server module

* Refactor into proxy module
2019-12-01 22:46:00 -08:00
Abhinav Singh 64192250ee
Remove public folder references (#212) 2019-12-01 21:30:29 -08:00
Abhinav Singh fff914e22b
Add support for regex based routing. Fixes #203 (#211) 2019-12-01 20:57:05 -08:00
Abhinav Singh 654696d2f9
Test Core Eventing (#205)
* Add core event tests

* Update .gitignore with coverage

* Add shortlink gif

* Add event dispatcher test

* Test event subscriber
2019-11-30 22:04:43 -08:00