Update upnp listener module to even be less strict in normal mode as I

have found instances of devices that do not follow the pure upnp
standard. Updated README as it was wrong for the upnp.device.db...it had
an s after device. updated the code to return back to config after
adding or updating a device.
This commit is contained in:
Admin
2015-09-10 16:08:29 -05:00
parent 74d4548beb
commit 774bc8a36b
5 changed files with 14 additions and 8 deletions

View File

@@ -72,7 +72,7 @@ public class UpnpListener {
DatagramPacket packet = new DatagramPacket(buf, buf.length);
upnpMulticastSocket.receive(packet);
String packetString = new String(packet.getData());
if(packetString != null && packetString.startsWith("M-SEARCH * HTTP/1.1")) {
if(packetString != null && packetString.contains("M-SEARCH")) {
if(traceupnp)
log.info("Trace SSDP packet from " + packet.getAddress().getHostAddress() + ":" + packet.getPort() + " body : " + packetString);
else
@@ -99,8 +99,8 @@ public class UpnpListener {
protected boolean isSSDPDiscovery(String body){
// log.debug("Check if this is a MAN ssdp-discover packet for a upnp basic device: " + body);
//Only respond to discover request for upnp basic device from echo, the others are for the wemo
if(body != null && body.startsWith("M-SEARCH * HTTP/1.1") && body.contains("MAN: \"ssdp:discover\"")){
if(strict && body.contains("ST: urn:schemas-upnp-org:device:basic:1"))
if(body != null && body.contains("M-SEARCH") && body.contains("\"ssdp:discover\"")){
if(strict && body.startsWith("M-SEARCH * HTTP/1.1") && body.contains("MAN: \"ssdp:discover\"") && body.contains("ST: urn:schemas-upnp-org:device:basic:1"))
return true;
else if (!strict || vTwoCompatibility)
return true;