lumeohq / onvif-rs

A native Rust ONVIF client library.
MIT License
115 stars 61 forks source link

Altered Clients::new() URL checks to use parsed URL. #101

Open ChironEvans opened 1 year ago

ChironEvans commented 1 year ago

Both the parsed url and the device management URL have the port stripped regardless of whether the input arg included one.

s.x_addr provided by the device includes a port on Uniview IPC devices, which leads to failed validation.

ChironEvans commented 1 year ago

I encountered an issue when attempting to connect to one of my IP Cameras made by Uniview.

Result:

thread 'main' panicked at 'called Result::unwrap() on an Err value: "advertised device mgmt uri http://192.168.3.23:80/onvif/device_service not expected http://192.168.3.23/onvif/device_service"', onvif\examples\camera.rs:458:45

What was happening was the unparsed URL was being compared to the Device Management URL Parsed URL: http://192.168.3.23/onvif/device_service Raw URL: http://192.168.3.23:80/onvif/device_service Device Management URL: http://192.168.3.23/onvif/device_service

Because the raw URL contained a port, the application panicked. This occurred whether my uri argument was uri=http://192.168.3.23:80 or uri=http://192.168.3.23.

Behavior after change: Camera example functionality returns device information.

DmitrySamoylov commented 1 year ago

@ChironEvans Can you fix formatting and force-push the branch, please?