e7299b17e9
Stack installed: - netfox v1.35.3 (core + extras + noray + internals) - godot-jolt v0.16.0-stable Architecture: - Server: ENet transport (works headless, no netfox deps) - Client/Editor: netfox rollback (RollbackSynchronizer, TickInterpolator) New/modified: - docs/migration-netfox-plan.md — migration architecture - scripts/network/network_manager.gd — netfox-aware ENet fallback - scripts/network/player.gd — clean base player - client/characters/player_netfox.gd — rollback player w/ WeaponManager - client/characters/input/player_net_input.gd — BaseNetInput subclass - client/characters/character/fps_character_controller.gd — netfox input feed - client/weapons/ — weapon data, registry, TacticalWeaponHitscan, WeaponManager - client/scripts/round_replicator.gd — client-side round state bridge - server/scripts/round_manager.gd — improved state machine - server/scripts/plugin_api/plugin_manager.gd — refined plugin system - config: enemy_tag, ally_tag for meatball targeting Removed: old C++ SimulationServer GDExtension (replaced by netfox rollback)
72 lines
1.9 KiB
Python
72 lines
1.9 KiB
Python
import http
|
|
|
|
from .. import datastructures
|
|
from ..exceptions import (
|
|
InvalidHandshake,
|
|
# InvalidMessage was incorrectly moved here in versions 14.0 and 14.1.
|
|
InvalidMessage, # noqa: F401
|
|
ProtocolError as WebSocketProtocolError, # noqa: F401
|
|
)
|
|
from ..typing import StatusLike
|
|
|
|
|
|
class InvalidStatusCode(InvalidHandshake):
|
|
"""
|
|
Raised when a handshake response status code is invalid.
|
|
|
|
"""
|
|
|
|
def __init__(self, status_code: int, headers: datastructures.Headers) -> None:
|
|
self.status_code = status_code
|
|
self.headers = headers
|
|
|
|
def __str__(self) -> str:
|
|
return f"server rejected WebSocket connection: HTTP {self.status_code}"
|
|
|
|
|
|
class AbortHandshake(InvalidHandshake):
|
|
"""
|
|
Raised to abort the handshake on purpose and return an HTTP response.
|
|
|
|
This exception is an implementation detail.
|
|
|
|
The public API is
|
|
:meth:`~websockets.legacy.server.WebSocketServerProtocol.process_request`.
|
|
|
|
Attributes:
|
|
status (~http.HTTPStatus): HTTP status code.
|
|
headers (Headers): HTTP response headers.
|
|
body (bytes): HTTP response body.
|
|
"""
|
|
|
|
def __init__(
|
|
self,
|
|
status: StatusLike,
|
|
headers: datastructures.HeadersLike,
|
|
body: bytes = b"",
|
|
) -> None:
|
|
# If a user passes an int instead of an HTTPStatus, fix it automatically.
|
|
self.status = http.HTTPStatus(status)
|
|
self.headers = datastructures.Headers(headers)
|
|
self.body = body
|
|
|
|
def __str__(self) -> str:
|
|
return (
|
|
f"HTTP {self.status:d}, {len(self.headers)} headers, {len(self.body)} bytes"
|
|
)
|
|
|
|
|
|
class RedirectHandshake(InvalidHandshake):
|
|
"""
|
|
Raised when a handshake gets redirected.
|
|
|
|
This exception is an implementation detail.
|
|
|
|
"""
|
|
|
|
def __init__(self, uri: str) -> None:
|
|
self.uri = uri
|
|
|
|
def __str__(self) -> str:
|
|
return f"redirect to {self.uri}"
|