From 2581b79db51bf600eedb2537e9a4990e308d2862 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 8 Oct 2018 18:46:22 -0400 Subject: [PATCH] fix --- aioupnp/protocols/ssdp.py | 9 ++++++--- aioupnp/serialization/ssdp.py | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/aioupnp/protocols/ssdp.py b/aioupnp/protocols/ssdp.py index 12f3000..1892511 100644 --- a/aioupnp/protocols/ssdp.py +++ b/aioupnp/protocols/ssdp.py @@ -30,16 +30,19 @@ class SSDPProtocol(MulticastProtocol): man=man, mx=1 ) log.debug("sending packet to %s:%i: %s", address, SSDP_PORT, packet) + print(packet.encode()) self.transport.sendto(packet.encode().encode(), (address, SSDP_PORT)) async def m_search(self, address, timeout: int = 1, service=UPNP_ORG_IGD) -> SSDPDatagram: if (address, service) in self.discover_callbacks: return self.discover_callbacks[(address, service)] - # D-Link, Cisco - self.send_m_search_packet(service, address, "\"%s\"" % SSDP_DISCOVER) + # D-Link works with both - # DD-WRT + # Cisco only works with quotes + self.send_m_search_packet(service, address, '"%s"' % SSDP_DISCOVER) + + # DD-WRT only works without quotes self.send_m_search_packet(service, address, SSDP_DISCOVER) f: Future = Future() diff --git a/aioupnp/serialization/ssdp.py b/aioupnp/serialization/ssdp.py index a684409..a65d689 100644 --- a/aioupnp/serialization/ssdp.py +++ b/aioupnp/serialization/ssdp.py @@ -112,8 +112,6 @@ class SSDPDatagram(object): raise UPnPError("required field for {} is missing: {}".format(self._packet_type, attr_name)) if attr_name == 'mx': value = str(attr) - elif attr_name == 'man': - value = "\"%s\"" % attr else: value = attr lines.append("{}: {}".format(attr_name.upper(), value))