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

Remove port from Host header #353

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions aiohomekit/controller/ip/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,17 @@ async def _connect_once(self) -> None:
)
connected_host = sock.getpeername()[0]
self.connected_host = connected_host
# The port is not included in the Host header for compatibility
# reasons. It may be safe to include it in the future if its
# not port 80, but currently we don't know of any devices that
# require it.
#
# We don't use the mdns name because that can trigger buffer
# overflows in some devices.
if ":" in connected_host:
self.host_header = f"Host: [{connected_host}]:{self.port}"
self.host_header = f"Host: [{connected_host}]"
else:
self.host_header = f"Host: {connected_host}:{self.port}"
self.host_header = f"Host: {connected_host}"
if self.owner:
await self.owner.connection_made(False)

Expand Down
Loading