Commit Graph

8 Commits

Author SHA1 Message Date
Abhinav Singh 90820b01f5
[ProxyPoolPlugin] Avoid remote proxy of private IP requests (#833)
* Avoid proxy of requests to private IP within `ProxyPoolPlugin`

* Fix tests

* spell fix
2021-12-01 05:29:52 +05:30
Abhinav Singh 921f2b56e0
Optimizations & Update Benchmark Results (#832)
* Bail out of lock earlier

* Avoid calling `get_events` for unfinished work tasks.  Use `cached_property` for `HttpParser` optimization

* Add `type: ignore[no-any-return]`, odd scenario

* We dont have to rebuild response packet repeatedly within `WebServerPlugin`

* Parse line and header in one invocation

* Minor optimizations and update benchmark to use `oha` instead of `hey`

* Remove `flask` from benchmark, only benchmark `asgi` or `async` based libraries.  Use `uvicorn` and 10 workers for `blacksheep`.  Use `oha` instead of `hey`

* Add benchmark for `starlette`

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

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

* Add missing dep

* pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-01 04:18:49 +05:30
Abhinav Singh 2b3f0cb422
Add all IANA assigned HTTP method names (#751)
* Ignore `docs/_build`

* Remove `v` prefix from VERSION.  Also added a `lib-doc` target

* Raise a `ValueError` instead of `NotImplementedError`

* Add all registered http method verbs

* Generate `_scm_version.py` on every `make` invocation.  Fix `v` prefix bug.

* `+proxy` for emails

* Make explicit that this script writes to file

* `PROXY_AGENT_HEADER_VALUE` still needs the `v` :)
2021-11-18 18:50:15 +05:30
JerryKwan 658acd822c
Handle invalid/malformed data from clients in HttpParser (#740)
* add validation in _process_line in parser.py

add validation in _process_line in proxy/http/parser/parser.py

* quick fail when parsing request

quick fail when parsing request
add test case for parsing invalid http request

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

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

* remove unnecessary checks and empty line

remove unnecessary checks and empty line

* minor fix

minor fix

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

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

* solve exception expression conflict

solve exception expression conflict

* use NotImplementedError temporary measure

use change HttpProtocolException to NotImplementedError for a temporary
measure

* change exception type in test

change exception type in test

* remove unnecessary import

remove unnecessary import

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Abhinav Singh <mailsforabhinav@gmail.com>
Co-authored-by: Abhinav Singh <126065+abhinavsingh@users.noreply.github.com>
2021-11-18 07:15:19 +05:30
Sviatoslav Sydorenko fa89944891
Add initial Sphinx docs 2021-11-18 01:36:13 +01:00
Abhinav Singh 7f1470e3a9
No abstract method for proxy plugin (#738)
* Remove abstractmethod for proxy plugin base class, remove unused methods from bundled plugins

* Move httpStatusCodes, httpMethods and Url within top-level proxy.http package
2021-11-15 03:17:12 +05:30
Abhinav Singh d72ee2227d
`--enable-proxy-protocol` : HAProxy Protocol v1 (#735)
* Introduce `--haproxy-protocol` flag

* Complete proxy protocol v1 implementation, enable using `--enable-proxy-protocol` flag

* link checks

* Advertise support for haproxy protocol in readme

* Add make target `lib-scm-version`

* `make lib-version` is now `make lib-check`

* Dont enforce -dev part of version within README

* Add provision to update readme flags using check

* Wrap help text within console

* Add closing ticks

* Remove verbose logging and update homebrew formulae (may be fixed?)
2021-11-14 10:43:20 +05:30
Abhinav Singh 541da114c8
Custom Url Parser (#730)
* Custom Url parser for our needs

* lint fix

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

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

* Fix proxy_pool plugin as scheme can be None if not present in the Url

* Address the ambiguous ipv6:port scenario along with valid cases

* lint checks

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

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

* docstring

* Abstract into `http.parser` module

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

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

* Fix #398 HTTP/1.0 related issue

* lint checks

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-12 19:00:19 +05:30