diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-10-26 12:31:46 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-10-26 12:31:46 +0200 |
commit | 2547f822148819d9d11111787bf66263f8445c81 (patch) | |
tree | 53428a88c753e96e9c4583382143bad1c4840c69 /src/hydrilla/proxy | |
parent | 9e60f02c00100e919d7f869aa7014e83a2a553b2 (diff) | |
download | haketilo-hydrilla-2547f822148819d9d11111787bf66263f8445c81.tar.gz haketilo-hydrilla-2547f822148819d9d11111787bf66263f8445c81.zip |
[proxy] properly handle wildcard protocols in payloads patterns
Diffstat (limited to 'src/hydrilla/proxy')
-rw-r--r-- | src/hydrilla/proxy/simple_dependency_satisfying.py | 11 | ||||
-rw-r--r-- | src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/hydrilla/proxy/simple_dependency_satisfying.py b/src/hydrilla/proxy/simple_dependency_satisfying.py index ffe4d62..ba40a20 100644 --- a/src/hydrilla/proxy/simple_dependency_satisfying.py +++ b/src/hydrilla/proxy/simple_dependency_satisfying.py @@ -98,8 +98,7 @@ class MappingChoice: required: bool = False mapping_dependencies: t.Sequence[item_infos.MappingInfo] = () - payloads: dict[url_patterns.ParsedPattern, ComputedPayload] = \ - dc.field(default_factory=dict) + payloads: dict[str, ComputedPayload] = dc.field(default_factory=dict) MappingsGraph = t.Union[ @@ -238,7 +237,13 @@ class _ComputationData: failure = False + processed_patterns = set() + for pattern, resource_spec in choice.info.payloads.items(): + if pattern.orig_url in processed_patterns: + continue + processed_patterns.add(pattern.orig_url) + computed_payload = self._satisfy_payload_resource( mapping_identifier = choice.info.identifier, resource_identifier = resource_spec.identifier @@ -253,7 +258,7 @@ class _ComputationData: if choice.info.allows_cors_bypass: computed_payload.allows_cors_bypass = True - choice.payloads[pattern] = computed_payload + choice.payloads[pattern.orig_url] = computed_payload if not failure: choices[choice.info.identifier] = choice diff --git a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py index 399e20e..97f9de6 100644 --- a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py +++ b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py @@ -389,7 +389,7 @@ def _recompute_dependencies_no_state_update_no_pull_files( ''', ( mapping_ver_id, - pattern.orig_url, + pattern, payload.allows_eval, payload.allows_cors_bypass ) @@ -404,7 +404,7 @@ def _recompute_dependencies_no_state_update_no_pull_files( WHERE mapping_item_id = ? AND pattern = ?; ''', - (mapping_ver_id, pattern.orig_url) + (mapping_ver_id, pattern) ) (payload_id,), = cursor.fetchall() |