Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to server without port triggers error #92

Open
megascatterbomb opened this issue Sep 23, 2024 · 0 comments
Open

Connecting to server without port triggers error #92

megascatterbomb opened this issue Sep 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@megascatterbomb
Copy link
Contributor

megascatterbomb commented Sep 23, 2024

It is possible to connect to servers without specifying a port; doing so will default to 27015. When this occurs, the IP without port will be passed to masterbase/app.py L88 and fail because there is no : to split against.

This could also be fixed by forcing the client-backend to specify the port in the request, but to maximize compatibility with older versions of the client the masterbase should assume a default of 27015.

fake_ip = unquote(fake_ip)
if not fake_ip.startswith("169"):
    to_resolve, port = fake_ip.split(":") # fails here
    fake_ip = f"{resolve_hostname(to_resolve)}:{port}"
start_session_helper(engine, steam_id, str(_session_id), demo_name, fake_ip, map)
INFO:     172.18.0.1:58868 - "GET /session_id?api_key=REDACTED&fake_ip=114.23.117.138&map=vsh_distillery&demo_name=demo2024-09-23_13-03-21.dem HTTP/1.1" 500 Internal Server Error
ERROR - 2024-09-23 01:03:28,841 - app - app - Exception occurred!
Traceback (most recent call last):
  File "/home/.venv/lib/python3.11/site-packages/litestar/middleware/_internal/exceptions/middleware.py", line 159, in __call__
    await self.app(scope, receive, capture_response_started)
  File "/home/.venv/lib/python3.11/site-packages/litestar/_asgi/asgi_router.py", line 99, in __call__
    await asgi_app(scope, receive, send)
  File "/home/.venv/lib/python3.11/site-packages/litestar/routes/http.py", line 80, in handle
    response = await self._get_response_for_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.venv/lib/python3.11/site-packages/litestar/routes/http.py", line 132, in _get_response_for_request
    return await self._call_handler_function(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.venv/lib/python3.11/site-packages/litestar/routes/http.py", line 152, in _call_handler_function
    response_data, cleanup_group = await self._get_response_data(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.venv/lib/python3.11/site-packages/litestar/routes/http.py", line 203, in _get_response_data
    data = route_handler.fn(**parsed_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/masterbase/app.py", line 88, in session_id
    to_resolve, port = fake_ip.split(":")
    ^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)
@megascatterbomb megascatterbomb added the bug Something isn't working label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant