diff --git a/src/arcade.egg-info/PKG-INFO b/src/arcade.egg-info/PKG-INFO new file mode 100644 index 0000000..ff62321 --- /dev/null +++ b/src/arcade.egg-info/PKG-INFO @@ -0,0 +1,27 @@ +Metadata-Version: 2.4 +Name: arcade +Version: 0.6.13.dev0 +Summary: One static host for every browser game (Stephenson-Software RFC 0006). +License: # License – Stephenson Software Non-Commercial License (Stephenson-NC) + + This project is licensed under the **Stephenson Software Non-Commercial License (Stephenson-NC)**. + + Copyright © 2026 Daniel McCoy Stephenson. All rights reserved. + Stephenson Software is the personal software lab of Daniel McCoy Stephenson and is **not** a legal entity. + + You may use, copy, modify, and distribute this software **for non-commercial purposes only**. + Commercial use by any party other than the copyright holder is prohibited without explicit written permission. + + ## Full License Text + The complete terms of this license are published at: + https://github.com/Stephenson-Software/stephenson-nc-license + + ## SPDX Identifier + Stephenson-NC + + ## No Warranty + This software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the copyright holder be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or its use. + +Requires-Python: >=3.8 +License-File: LICENSE +Dynamic: license-file diff --git a/src/arcade.egg-info/SOURCES.txt b/src/arcade.egg-info/SOURCES.txt new file mode 100644 index 0000000..1ea967b --- /dev/null +++ b/src/arcade.egg-info/SOURCES.txt @@ -0,0 +1,56 @@ +LICENSE +README.md +pyproject.toml +src/arcade/__init__.py +src/arcade/__main__.py +src/arcade/activity.py +src/arcade/bundle.py +src/arcade/filters.py +src/arcade/hall.py +src/arcade/hall_model.py +src/arcade/landing.py +src/arcade/precompress.py +src/arcade/registry.py +src/arcade/remote.py +src/arcade/routers.py +src/arcade/seasons.py +src/arcade/server.py +src/arcade/store.py +src/arcade/trace_client.py +src/arcade/visits.py +src/arcade/walks.py +src/arcade.egg-info/PKG-INFO +src/arcade.egg-info/SOURCES.txt +src/arcade.egg-info/dependency_links.txt +src/arcade.egg-info/top_level.txt +src/arcade/hosting/__init__.py +src/arcade/hosting/core.py +src/arcade/hosting/model.py +src/arcade/hosting/service.py +src/arcade/hosting/adapters/__init__.py +src/arcade/hosting/adapters/null_reporter.py +src/arcade/hosting/adapters/reloading_yaml_catalog.py +src/arcade/hosting/ports/__init__.py +src/arcade/hosting/ports/event_reporter.py +src/arcade/hosting/ports/game_catalog.py +src/arcade/hosting/ports/play_counter.py +src/arcade/hosting/ports/release_notes.py +src/arcade/hosting/ports/version_store.py +tests/test_bundle.py +tests/test_filters.py +tests/test_hall.py +tests/test_hosting_architecture.py +tests/test_hosting_characterization.py +tests/test_hosting_contracts.py +tests/test_hosting_core.py +tests/test_landing.py +tests/test_main.py +tests/test_precompress.py +tests/test_registry.py +tests/test_remote.py +tests/test_routers.py +tests/test_seasons.py +tests/test_server.py +tests/test_store.py +tests/test_visits.py +tests/test_walks.py \ No newline at end of file diff --git a/src/arcade.egg-info/dependency_links.txt b/src/arcade.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/arcade.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/src/arcade.egg-info/top_level.txt b/src/arcade.egg-info/top_level.txt new file mode 100644 index 0000000..ab9354e --- /dev/null +++ b/src/arcade.egg-info/top_level.txt @@ -0,0 +1 @@ +arcade diff --git a/src/arcade/server.py b/src/arcade/server.py index a8fb649..fa8333a 100644 --- a/src/arcade/server.py +++ b/src/arcade/server.py @@ -313,16 +313,26 @@ def _dispatch(self, read): ) self._json(200, document) else: + if not read: + self._drain() self._text(404, "Not found") return if host == config.domain: self._api(path, read) return + # Past here nothing reads a request body, so a POST or PUT is + # refused - but its body is still read first. Left unread on a + # kept-alive connection, it would be parsed as the start of the + # proxy's next request, and that request answered 501 (a game + # beaconing to its own origin broke the clip loaded after it). game = arcade.hosting.gameForHost(host) if game is None: + if not read: + self._drain() self._text(404, "No game is served at this address.") return if not read: + self._drain() self._text(405, "Games are read-only; uploads go to https://%s/api/" % config.domain) return self._game(game, path) diff --git a/tests/test_server.py b/tests/test_server.py index 3acbe24..96bbb14 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -977,3 +977,24 @@ def test_a_bundle_needs_a_deployed_game_and_lives_on_the_api_host_only(arcade): assert request(arcade, "POST", API, "/api/games/tidewater/bundle")[0].status == 404 response, data = request(arcade, "HEAD", API, "/api/games/tidewater/bundle") assert response.status == 200 and data == b"" and int(response.getheader("Content-Length")) > 0 + + +def test_a_refused_post_does_not_poison_the_next_request_on_a_kept_alive_connection(arcade): + # A game that beacons to its own origin (Forward One POSTs to /api/river-log) + # gets a 405 from a game host. Its body must be read before the next request + # on the same connection, or the proxy's next request (a clip, a tile) is + # parsed starting at the JSON and answered 501. + upload(arcade) + body = b'{"kind":"visit","t":1}' + for host, method in ((TIDEWATER, "POST"), (TIDEWATER, "PUT"), ("nope." + DOMAIN, "POST")): + connection = http.client.HTTPConnection("127.0.0.1", arcade.port, timeout=10) + connection.request(method, "/api/river-log", body=body, + headers={"Host": host, "Content-Type": "application/json"}) + refused = connection.getresponse() + refused.read() + assert refused.status in (404, 405) + connection.request("GET", "/", headers={"Host": TIDEWATER}) + after = connection.getresponse() + after.read() + assert after.status == 200, (host, method, after.status) + connection.close()