pierrickrouxel / SSDPClient

SSDP client for Swift
MIT License
45 stars 16 forks source link

Incorrect parsing #21

Closed nmalevich closed 3 weeks ago

nmalevich commented 2 months ago

Response: "HTTP/1.1 200 OK\r\nCache-Control: max-age=1800\r\nDate: Thu, 06 Jun 2024 11:01:02 GMT\r\nST: upnp:rootdevice\r\nEXT: \r\nSERVER: Platform 1.0 His/1.0 UPnP/1.0 DLNADOC/1.50\r\nUSN: uuid:898e0775-23f2-11ef-8b3d-84ba39bb8fb2::upnp:rootdevice\r\nLocation: http://192.168.1.59:38400/MediaServer/rendererdevicedesc.xml\r\n\r\n"

Parsed location: "http://192.168.1.59:38400/MediaServer/rendererdevicedes"

Correct location: "http://192.168.1.59:38400/MediaServer/rendererdevicedesc.xml"

Could you please fix that and submit new release? You can do that by replacing "let matches = HeaderRegex.matches(in: response, range: NSRange(location: 0, length: response.count))" with "let matches = HeaderRegex.matches(in: response, range: NSRange(location: 0, length: response.utf16.count))"

Thank you a lot

pierrickrouxel commented 1 month ago

@nmalevich I will fix this problem by the end of month.

pierrickrouxel commented 3 weeks ago

Hello @nmalevich, I investigating your issue. Why you string is in UTF-16? Can you tell me more about the UPNP device you use?

pierrickrouxel commented 3 weeks ago

Sorry I understood. It's a swift behaviour. It's fixed.