lumeohq / onvif-rs

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

camera example incorrect url matching #76

Closed wiseman closed 3 years ago

wiseman commented 3 years ago

My camera's ONVIF port is 80, and that seems to make it hard to pass a URI to examples/camera that it will accept.

$ ./target/debug/examples/camera get-all --uri http://192.168.1.200/
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
"Service URI http://192.168.1.200:80/Device is not within base URI http://192.168.1.200/"',
onvif/examples/camera.rs:404:45

$ ./target/debug/examples/camera get-all --uri http://192.168.1.200:80/
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
"Service URI http://192.168.1.200:80/Device is not within base URI http://192.168.1.200/"',
onvif/examples/camera.rs:404:45

It seems to be due to this code in example.rs:

if !s.x_addr.starts_with(base_uri.as_str()) {
    return Err(format!(
        "Service URI {} is not within base URI {}",
         &s.x_addr, &base_uri
    ));
}