Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ jobs:
fetch-depth: 0
ref: ${{ github.ref }}

- env:
- name: Switch to the head branch
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: git switch -C "$BRANCH"

Expand Down Expand Up @@ -221,7 +222,8 @@ jobs:
fetch-depth: 0
ref: ${{ github.ref }}

- env:
- name: Switch to the head branch
env:
BRANCH: ${{ github.ref_name }}
run: git switch -C "$BRANCH"

Expand Down
10 changes: 10 additions & 0 deletions src/zeroconf/_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def entry_to_string(self, hdr: str, other: bytes | str | None) -> str:


class DNSQuestion(DNSEntry):
"""A question a resolver asks about a name."""

__slots__ = ("_hash",)

def __init__(self, name: str, type_: int, class_: int) -> None:
Expand Down Expand Up @@ -232,6 +234,8 @@ def to_string(self, other: bytes | str) -> str:


class DNSAddress(DNSRecord):
"""Record holding an IPv4 or IPv6 address."""

__slots__ = ("_hash", "address", "scope_id")

def __init__(
Expand Down Expand Up @@ -338,6 +342,8 @@ def __repr__(self) -> str:


class DNSPointer(DNSRecord):
"""PTR record naming a service instance."""

__slots__ = ("_hash", "alias", "alias_key")

def __init__(
Expand Down Expand Up @@ -389,6 +395,8 @@ def __repr__(self) -> str:


class DNSText(DNSRecord):
"""TXT record carrying the service properties."""

__slots__ = ("_hash", "text")

def __init__(
Expand Down Expand Up @@ -431,6 +439,8 @@ def __repr__(self) -> str:


class DNSService(DNSRecord):
"""SRV record with the target host, port, priority and weight."""

__slots__ = ("_hash", "port", "priority", "server", "server_key", "weight")

def __init__(
Expand Down
10 changes: 10 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def teardown_module():


class Names(unittest.TestCase):
def test_long_name(self):
generated = r.DNSOutgoing(const._FLAGS_QR_RESPONSE)
question = r.DNSQuestion(
"an.excessively.deep.chain.of.dns.labels.used.for.testing.local.",
const._TYPE_SRV,
const._CLASS_IN,
)
generated.add_question(question)
r.DNSIncoming(generated.packets()[0])

def test_exceedingly_long_name(self):
generated = r.DNSOutgoing(const._FLAGS_QR_RESPONSE)
name = f"{'part.' * 1000}local."
Expand Down
Loading