Commit Graph

253 Commits

Author SHA1 Message Date
Abhinav Singh 80c73a4798 Do not store raw response bytes for CONNECT requests.
Fixes #67 and addresses #66 too.
2019-09-13 11:03:26 -07:00
Abhinav Singh 3e92faba32 Necessary productionization tests. 2019-09-03 12:54:47 -07:00
Abhinav Singh ef4003c1be Merge branch 'develop' of github.com:abhinavsingh/proxy.py into develop 2019-09-03 09:54:09 -07:00
Abhinav Singh 81b678f223 Update LICENSE 2019-09-03 09:53:14 -07:00
Abhinav Singh d387013a3f Merge branch 'master' into develop 2019-09-03 09:51:36 -07:00
Abhinav Singh 7e0e379a76 Merge branch 'develop' of github.com:abhinavsingh/proxy.py into develop 2019-09-03 08:58:09 -07:00
Abhinav Singh c80901689a Add Procfile.
Several forks have introduced a Procfile. It doesn't hurt to have one in
the repo itself.
2019-09-03 08:57:20 -07:00
Abhinav Singh cd10b9aa24
Update LICENSE 2019-09-02 22:55:34 -07:00
Abhinav Singh 95671e4905 Address ipv6 parsing from Http requests #65 2019-09-02 22:08:54 -07:00
Abhinav Singh c3cd9be816 Add --disable-headers option. Fixes #31 2019-09-02 15:58:37 -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 3bf0f0754b v1.0 2019-08-26 10:54:19 -07:00
Abhinav Singh d0f696212e Add --pid-file option to dump parent process ID to a file.
Rename to --disable-http-proxy.

Is more appropriate since proxy is always enabled.

unittest.skipIf right guards for travis
2019-08-26 10:54:17 -07:00
Abhinav Singh a5a0149402 Add option (--log-file) to redirect logs to a file 2019-08-26 10:54:17 -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 3a371f2d6f Add tests for proxy.main 2019-08-26 10:54:17 -07:00
Abhinav Singh 19d47ad792 Create separate base plugin HttpProxyBasePlugin for proxy handling only
Disable open file limit tests for Windows
2019-08-26 10:54:14 -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 e463d428b9 Enable WebServer plugin when --pac_file serving is requested.
1. Also binary read pac file instead of str
2. Return 404 for unhandled WebServer requests
2019-08-24 10:11:57 -07:00
Abhinav Singh 2c239a1d25 Merge branch 'develop' of github.com:abhinavsingh/proxy.py into develop 2019-08-24 09:51:18 -07:00
Abhinav Singh 5343350c3c
Merge pull request #62 from abhinavsingh/plugins
Proxy Plugins
2019-08-24 09:42:51 -07:00
Abhinav Singh 4019e95850 Per worker queue instead of shared one.
1. MultiCoreDispatcher now dispatches request in round robin fashion.
2. Added Python3 static type hinting

add Google Cloud Run Button

Preserve proxy.py name as otherwise it breaks module system.  Just provide a custom service name to fix Google Cloud Run issue

Custom service name for Google Cloud Run.

Specify port in app.json as required by Google Cloud Run

Go cannot unmarshall int :)

Port desc

Looks like PORT cannot be overridden, for now use port 8080 in Dockerfile

Remove cloudrun integration.

While proxy.py runs successfully within the container, gvisor
limitations doesn't allow proxy.py to accept client connections.
Specifically membarrier syscall isn't allowed.

Update README.md
2019-08-24 09:31:56 -07:00
Abhinav Singh 6ea42b0dd9 Convert HttpProxy and HttpWebServer itself into plugins.
Load plugins during test execution

Further decouple proxy/webserver logic outside of HttpProtocolHandler.

Per connection plugin instances to avoid locks

Handle BrokenPipeError and teardown if read_from_descriptors return True
2019-08-24 09:31:53 -07:00
Abhinav Singh 8732cb7151 Refactor HttpProxy.run
Fix tests for py2.7 which require external mock module

Disable tests which require listening on sockets for Travis.

Make travis make free

set TESTING_ON_TRAVIS=1 for windows
2019-08-24 09:31:50 -07:00
Abhinav Singh 6b49de2ce6 Core changes:
1. Rename HttpServer to MultiCoreRequestDispatcher, there wasn't
anything Http about that class, all Http implementation happens in
HttpProxy class
2. PY 2.7 DEPRECATION ERRORS
3. Add --log-format cli option
4. Remove _ from HttpProxy private methods, refactor it's core for
clarify (remove redundant close() and other details)
2019-08-24 09:31:50 -07:00
Abhinav Singh 03104cc54d Add TcpServer tests and make accept non-blocking.
Non-blocking accepts helps specially in tests to abort the test server
gracefully.

Add ipv6 tcp server client tests

Add tests for TcpServer and HttpServer

Add HttpProxyConfig object to avoid unnecessary arg passing.
2019-08-24 09:31:45 -07:00
Abhinav Singh c8fabb86c4 Camel case consistency and more tests.
Add plugins to proxy.py for programmable proxy.

As requested in https://github.com/abhinavsingh/proxy.py/issues/30 and
other mediums, introduce proxy.py plugins.  plugin_examples.py provides
examples for how to use them.

Add capability for plugins to simply ProxyRejectRequest.
2019-08-24 09:30:59 -07:00
Abhinav Singh d9946015a7 Camel case consistency 2019-08-12 09:45:27 -07:00
Abhinav Singh 60e1ac1bc2 Link Travis Board for build status image 2019-08-11 22:41:39 -07:00
Abhinav Singh 824ba57589 Disable tests for Python 2.7 version 2019-08-11 21:47:24 -07:00
Abhinav Singh 653163532c Remove -v flag 2019-08-11 21:43:26 -07:00
Abhinav Singh be7235bf0d Add tests for worker and main 2019-08-11 21:02:51 -07:00
Abhinav Singh 4c09a677a3 Add proxy.py banner image 2019-08-11 10:43:59 -07:00
Abhinav Singh 91be448045 Only run if Python 3+.
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
2019-08-11 01:36:24 -07:00
Abhinav Singh 271352c9dc
Merge pull request #57 from abhinavsingh/refactor
Refactor
2019-07-26 09:28:33 -07:00
Abhinav Singh a182213c57 Refactor
1. Update class name to be more verbose
2. Update docstring for important classes
3. Global default constants
2019-07-23 17:57:47 -07:00
Abhinav Singh 1bf46b467e No explicit disconnect upon request completion.
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.
2019-07-21 17:54:55 -07:00
Abhinav Singh 6be854e1e0 Read and serve pacfile in oneshot 2019-07-20 14:32:02 -07:00
Abhinav Singh a563baadcf
Merge pull request #56 from abhinavsingh/workers
Pre-spawn worker processes to utilize all cores.
2019-07-20 13:28:21 -07:00
Abhinav Singh ef91d7d30b py2.7 fix 2019-07-20 13:22:30 -07:00
Abhinav Singh 0a8b40e51e Spawn worker threads 2019-07-20 13:16:10 -07:00
Abhinav Singh ad7eb517de Pre-spawn worker processes to utilize all cores. 2019-07-20 12:47:16 -07:00
Abhinav Singh f3c1ce664e Update README.md 2019-07-20 12:17:01 -07:00
Abhinav Singh d889bbd083
Merge pull request #55 from abhinavsingh/cli
Default listen on IPv6 now.
2019-07-20 11:55:05 -07:00
Abhinav Singh c7cd00d95e Default listen on IPv6 now.
Use `--ipv4 1` to only listen on IPv4. Fixes #48
2019-07-20 11:52:43 -07:00
Abhinav Singh 8f1c061aad
Merge pull request #54 from abhinavsingh/cli
Log Level CLI arguments
2019-07-20 11:44:53 -07:00
Abhinav Singh 75a118cac1 Allow both upper/lower case as well as first character to set the log level 2019-07-20 11:38:24 -07:00
Abhinav Singh 8e326e38bd Remove redundant cast of cli arguments 2019-07-20 11:31:45 -07:00
Abhinav Singh a0021cdb3a
Merge pull request #35 from pbi-qfs/develop
Added --pac-file option to serve a Proxy Autoconfig file
2019-06-03 23:32:36 -07:00