From 7da00f1d68604de79d61ecca0ff0327bf1af4ee3 Mon Sep 17 00:00:00 2001 From: Matthew Skinner Date: Wed, 2 Mar 2022 23:21:40 +1100 Subject: [PATCH] Digest fix for doorbird. (#12399) Signed-off-by: Matthew Skinner --- .../ipcamera/internal/handler/IpCameraHandler.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java b/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java index 423a20f6f..ec01d4151 100644 --- a/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java +++ b/bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java @@ -213,7 +213,7 @@ public class IpCameraHandler extends BaseThingHandler { try { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; - if (response.status().code() != 401) { + if (response.status().code() == 200) { if (!response.headers().isEmpty()) { for (String name : response.headers().names()) { // Some cameras use first letter uppercase and others dont. @@ -253,7 +253,7 @@ public class IpCameraHandler extends BaseThingHandler { } } } else { - // 401 errors already handled in pipeline by MyNettyAuthHandler.java + // Non 200 OK replies are logged and handled in pipeline by MyNettyAuthHandler.java return; } } @@ -570,7 +570,7 @@ public class IpCameraHandler extends BaseThingHandler { if (!"PUT".equals(httpMethod) || (useDigestAuth && digestString == null)) { request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, new HttpMethod(httpMethod), httpRequestURL); request.headers().set("Host", cameraConfig.getIp() + ":" + port); - request.headers().set("Connection", HttpHeaderValues.KEEP_ALIVE); + request.headers().set("Connection", HttpHeaderValues.CLOSE); } else { request = putRequestWithBody; } @@ -1648,7 +1648,8 @@ public class IpCameraHandler extends BaseThingHandler { } private void tryConnecting() { - if (!thing.getThingTypeUID().getId().equals(GENERIC_THING)) { + if (!thing.getThingTypeUID().getId().equals(GENERIC_THING) + && !thing.getThingTypeUID().getId().equals(DOORBIRD_THING)) { onvifCamera = new OnvifConnection(this, cameraConfig.getIp() + ":" + cameraConfig.getOnvifPort(), cameraConfig.getUser(), cameraConfig.getPassword()); onvifCamera.setSelectedMediaProfile(cameraConfig.getOnvifMediaProfile());