GGist / ssdp-rs

Simple Service Discovery Protocol In Rust
Apache License 2.0
42 stars 13 forks source link

Invalid http #42

Closed joprice closed 5 years ago

joprice commented 6 years ago

I tried using this to discover sonos devices, and received no responses. When i enabled debug logging, I saw this:

Received Invalid HTTP: HTTP/1.1 200 OK
CACHE-CONTROL: max-age = 3600
EXT:
LOCATION: http://192.168.1.158:1400/xml/group_description.xml
SERVER: Linux UPnP/1.0 Sonos/42.2-51240 (ZPS13)
ST: urn:smartspeaker-audio:service:SpeakerGroup:1
USN: uuid:RINCON_7828CA18303A01400::urn:smartspeaker-audio:service:SpeakerGroup:1
BOOTID.UPNP.ORG: 24
CONFIGID.UPNP.ORG: 1

I'm guessing that it's tripping up on the empty EXT header? If that is the case, is there any workaround either by recovering from an error like this and patching it, or having the parser drop invalid headers? I noticed that the http parser is not directly part of this lib, so I would understand if there's no local solution.

joprice commented 5 years ago

I modified the code to include the parse error in the response and see this:

DEBUG:ssdp::message::ssdp     : Received Invalid HTTP: end of stream before headers finished HTTP/1.1 200 OK
GGist commented 5 years ago

Merged PR, assuming that fixed this. Thanks!