aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/policies/base.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-09-09 11:44:59 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-12 13:59:10 +0200
commit6036bad4c167633d41f01e030ec1ae919dbfab0a (patch)
tree02e164e6b7860dc69af1820fb1a53334aff1332f /src/hydrilla/proxy/policies/base.py
parentd6e8e36e04fc36d42f9b985c47e2cd3b35907cc8 (diff)
downloadhaketilo-hydrilla-6036bad4c167633d41f01e030ec1ae919dbfab0a.tar.gz
haketilo-hydrilla-6036bad4c167633d41f01e030ec1ae919dbfab0a.zip
[proxy] allow prompting the user when a package suitable for current site is found; add proxy's options page
This commit also causes uncached responses to be forced on all HTTP request to external servers. This is needed to make sure that changes Haketilo makes to HTTP response headers are always picked up by the browser. The drawback is that this increases network traffic causing a performance hit. We might optimize this in the future.
Diffstat (limited to 'src/hydrilla/proxy/policies/base.py')
-rw-r--r--src/hydrilla/proxy/policies/base.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/hydrilla/proxy/policies/base.py b/src/hydrilla/proxy/policies/base.py
index bb95d29..8ffc45e 100644
--- a/src/hydrilla/proxy/policies/base.py
+++ b/src/hydrilla/proxy/policies/base.py
@@ -58,22 +58,21 @@ class Policy(ABC):
"""...."""
process_request: t.ClassVar[bool] = False
process_response: t.ClassVar[bool] = False
+ anticache: t.ClassVar[bool] = True
priority: t.ClassVar[PolicyPriority]
- @property
- def anticache(self) -> bool:
- return self.process_request or self.process_response
-
def consume_request(self, request_info: http_messages.RequestInfo) \
-> t.Optional[ProducedMessage]:
- """...."""
- return None
+ raise NotImplementedError(
+ 'This kind of policy does not consume requests.'
+ )
def consume_response(self, response_info: http_messages.ResponseInfo) \
-> t.Optional[http_messages.ProducedResponse]:
- """...."""
- return None
+ raise NotImplementedError(
+ 'This kind of policy does not consume responses.'
+ )
# mypy needs to be corrected: