diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-07 10:30:38 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-07 11:15:19 +0200 |
commit | 2e5b690e84fd168ba169c17581f59b8e1d1f430e (patch) | |
tree | 8239ed9531e9e5b41af1468f123092037c7ec5eb /src/hydrilla/proxy/policies/base.py | |
parent | 48f80ae480e2fc0eabbdb5041e841b80c0f788f4 (diff) | |
download | haketilo-hydrilla-2e5b690e84fd168ba169c17581f59b8e1d1f430e.tar.gz haketilo-hydrilla-2e5b690e84fd168ba169c17581f59b8e1d1f430e.zip |
[proxy] support unrestricted HTTP requests API in Haketilo payloads
Diffstat (limited to 'src/hydrilla/proxy/policies/base.py')
-rw-r--r-- | src/hydrilla/proxy/policies/base.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/hydrilla/proxy/policies/base.py b/src/hydrilla/proxy/policies/base.py index b7beba3..c02ea0b 100644 --- a/src/hydrilla/proxy/policies/base.py +++ b/src/hydrilla/proxy/policies/base.py @@ -40,6 +40,7 @@ from abc import ABC, abstractmethod from immutables import Map +from ... url_patterns import ParsedUrl from .. import state from .. import http_messages @@ -57,12 +58,18 @@ ProducedMessage = t.Union[ class Policy(ABC): """....""" - process_request: t.ClassVar[bool] = False - process_response: t.ClassVar[bool] = False - anticache: t.ClassVar[bool] = True + _process_request: t.ClassVar[bool] = False + _process_response: t.ClassVar[bool] = False + anticache: t.ClassVar[bool] = True priority: t.ClassVar[PolicyPriority] + def should_process_request(self, parsed_url: ParsedUrl) -> bool: + return self._process_request + + def should_process_response(self, parsed_url: ParsedUrl) -> bool: + return self._process_response + def consume_request(self, request_info: http_messages.RequestInfo) \ -> t.Optional[ProducedMessage]: raise NotImplementedError( |