Skip to content

Commit d5f5b1e

Browse files
committed
fix(client): Add support https if Device behind NAT/Proxy & Change service_path fallback for Search service
1 parent 40e9485 commit d5f5b1e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

onvif/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _get_xaddr(self, service_name: str, service_path: str):
153153
connect_port = self.common_args["port"]
154154
# if host/port differ, rewrite XAddr to use connection values
155155
if (device_host != connect_host) or (device_port != connect_port):
156-
protocol = parsed.scheme
156+
protocol = "https" if self.common_args["use_https"] else "http"
157157
new_netloc = f"{connect_host}:{connect_port}"
158158
rewritten = urlunparse((protocol, new_netloc, parsed.path, "", "", ""))
159159
return rewritten

onvif/services/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self, xaddr=None, **kwargs):
1010
self.operator = ONVIFOperator(
1111
definition["path"],
1212
binding=f"{{{definition['namespace']}}}{definition['binding']}",
13-
service_path="Search", # fallback
13+
service_path="SearchRecording", # fallback
1414
xaddr=xaddr,
1515
**kwargs,
1616
)

0 commit comments

Comments
 (0)