Yortw / RSSDP

Really Simple Service Discovery Protocol - a 100% .Net implementation of the SSDP protocol for publishing custom/basic devices, and discovering all device types on a network.

Home Page:http://yortw.github.io/RSSDP/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty custom properties break the description parser

martinwiboe opened this issue · comments

If the server returns a document with an empty custom property, the parsing completes too early. This means that further properties are not read.

For example, assume we get this response from the server:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
    <UDN>uuid:55076f6e-6b79-1d65-a472-00059a3c7a00</UDN>
    <friendlyName>Twonky :)</friendlyName>
    <pv:extension xmlns:pv="http://www.pv.com/pvns/"></pv:extension>
    <manufacturer>PacketVideo</manufacturer>
    <manufacturerURL>http://www.pv.com</manufacturerURL>
    <modelName>TwonkyServer</modelName>
    <modelURL>http://www.twonky.com</modelURL>
    <modelDescription>TwonkyServer (Windows, T-206)</modelDescription>
    <modelNumber>8.4</modelNumber>
    <serialNumber>8.4</serialNumber>
  </device>
</root>

Properties after the empty <pv:extension> tag (starting with manufacturer) will not be initialized. This seems to be a bug in SsdpDevice.AddCustomProperty where the XmlReader is advanced too far in the document.

This is due to using reader.Name in the inner loop of AddCustomProperty. I have created #60 that changes this behavior.

Excellent, thanks so much both for reporting the issue and for the pull request. I've merge this along with an accompanying test using the above XML and have published an updated package to Nuget.

@Yortw thanks for the quick response!