-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve parsing of broken XML on responses by ignoring namespaces #224
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #224 +/- ##
===============================================
+ Coverage 72.46% 72.56% +0.10%
===============================================
Files 19 19
Lines 4049 4093 +44
===============================================
+ Hits 2934 2970 +36
- Misses 1115 1123 +8 ☔ View full report in Codecov by Sentry. |
Can you test if this works for you, @brostosjoined? |
Discoveries: {{'CACHE-CONTROL': 'max-age=1800', 'DATE': 'Tue, 26 Mar 2024 06:49:03 GMT', 'EXT': '', 'LOCATION': 'http://192.168.100.1:49652/49652gatedesc.xml', 'OPT': '"http://schemas.upnp.org/upnp/1/0/"; ns=01', '01-NLS': 'cf2f9c7c-732d-11be-aad3-96b10c8ac404', 'SERVER': 'Linux/4.4.240, UPnP/1.0, Portable SDK for UPnP devices/1.12.1', 'X-User-Agent': 'UPnP/1.0 DLNADOC/1.50', 'ST': 'urn:schemas-upnp-org:device:InternetGatewayDevice:1', 'USN': 'uuid:00e0fc37-2525-2828-2500-58AEA862CCCB::urn:schemas-upnp-org:device:InternetGatewayDevice:1', '_host': '192.168.100.1', '_udn': 'uuid:00e0fc37-2525-2828-2500-58AEA862CCCB', '_location_original': 'http://192.168.100.1:49652/49652gatedesc.xml', 'location': 'http://192.168.100.1:49652/49652gatedesc.xml', '_timestamp': datetime.datetime(2024, 3, 26, 9, 49, 1, 880942), '_remote_addr': ('192.168.100.1', 46598), '_port': 46598, '_local_addr': ('0.0.0.0', 63359), '_source': <SsdpSource.SEARCH: 'search'>}}
Using device at location: http://192.168.100.1:49652/49652gatedesc.xml
Creating port mapping
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:GetExternalIPAddressResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewExternalIPAddress>100.65.26.64</NewExternalIPAddress>
</u:GetExternalIPAddressResponse>
</s:Body> </s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:AddPortMappingResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"></u:AddPortMappingResponse>
</s:Body> </s:Envelope>
Deleting port mapping
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:GetExternalIPAddressResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewExternalIPAddress>100.65.26.64</NewExternalIPAddress>
</u:GetExternalIPAddressResponse>
</s:Body> </s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:DeletePortMappingResponse xmlns:u0="urn:schemas-upnp-org:service:WANIPConnection:1"></u:DeletePortMappingResponse>
</s:Body> </s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:DeletePortMappingResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"></u:DeletePortMappingResponse>
</s:Body> </s:Envelope> 👍 |
let me try it using the |
Great, thanks! |
Yeah its working perfectly |
Great, thank you for testing. I'll create a new release somewhere this weekend. |
I've tested a bit more with Home Assistant and did not see any errors. I'll release a new version. I'll also create a Home Assistant PR to bump the version as well, though I don't think you're interested in this. |
Count me out on that but ill still be taking a look at the project. |
Discoveries: {{'CACHE-CONTROL': 'max-age=1800', 'DATE': 'Thu, 01 Jan 1981 21:40:53 GMT', 'EXT': '', 'LOCATION': 'http://192.168.100.1:49652/49652gatedesc.xml', 'OPT': '"http://schemas.upnp.org/upnp/1/0/"; ns=01', '01-NLS': '9f8f6628-1dd1-11b2-9b6c-9cbb8849d28c', 'SERVER': 'Linux/3.10.53-HULK2, UPnP/1.0, Portable SDK for UPnP devices/1.6.18', 'X-User-Agent': 'UPnP/1.0 DLNADOC/1.50', 'ST': 'urn:schemas-upnp-org:device:InternetGatewayDevice:1', 'USN': 'uuid:00e0fc37-2525-2828-2500-A0A33BAE4E09::urn:schemas-upnp-org:device:InternetGatewayDevice:1', '_host': '192.168.100.1', '_udn': 'uuid:00e0fc37-2525-2828-2500-A0A33BAE4E09', '_location_original': 'http://192.168.100.1:49652/49652gatedesc.xml', 'location': 'http://192.168.100.1:49652/49652gatedesc.xml', '_timestamp': datetime.datetime(2024, 4, 29, 13, 12, 25, 239614), '_remote_addr': ('192.168.100.1', 56143), '_port': 56143, '_local_addr': ('0.0.0.0', 51398), '_source': <SsdpSource.SEARCH: 'search'>}}
Using device at location: http://192.168.100.1:49652/49652gatedesc.xml
Creating port mapping
Deleting port mapping |
Improve parsing of broken XML on responses by ignoring namespaces
Fixes #221