Image with url and digest authentication

Hello,

I have following in my Sitemap

Image url="http://admin:password@10.0.0.7/mjpeg/snap.cgi?chn=1"

This works on openhab2 b3, but not on openhab2 b4.

I tested this with wget

--2016-09-24 20:05:05--  http://admin:*password*@10.0.0.7/mjpeg/snap.cgi?chn=1
Connecting to 10.0.0.7:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Connecting to 10.0.0.7:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified
Saving to: ‘snap.cgi?chn=1.1’

    [ <=>                                   ] 12,880      --.-K/s   in 0.03s

2016-09-24 20:05:05 (407 KB/s) - ‘snap.cgi?chn=1.1’ saved [12880]

From the openhab logs I can’t find anything. I was trying to find proper karaf commands to get more out of logs, but I was not able to find documentation for that.

To set f.e. zwave do debug you can use:
log:set debug org.openhab.binding.zwave

Thanks,

I was trying to check logs with this:

log:set debug 

Of course lot of stuff coming.

2016-09-25 16:41:14.376 [DEBUG] [pse.jetty.client.HttpClientTransport] - Created HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.376 [DEBUG] [.eclipse.jetty.io.AbstractConnection] - onOpen HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.376 [DEBUG] [.eclipse.jetty.io.AbstractConnection] - fillInterested HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.376 [DEBUG] [.eclipse.jetty.io.AbstractConnection] - IDLE–>FILL_INTERESTED HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.376 [DEBUG] [lipse.jetty.io.SelectChannelEndPoint] - Local interests updating 0 → 1 for SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,R,-,0/0,HttpConnectionOverHTTP}{io=1,kio=0,kro=8}
2016-09-25 16:41:14.376 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Queued change org.eclipse.jetty.io.SelectChannelEndPoint$1@6ae8caa0
2016-09-25 16:41:14.377 [DEBUG] [.eclipse.jetty.client.ConnectionPool] - Connection 1/64 creation succeeded HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.377 [DEBUG] [.eclipse.jetty.client.ConnectionPool] - Connection idle HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.377 [DEBUG] [.eclipse.jetty.client.ConnectionPool] - Connection active HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.377 [DEBUG] [eclipse.jetty.client.HttpDestination] - Processing exchange HttpExchange@63395c94 req=PENDING/null@null res=PENDING/null@null on HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]] of HttpDestination[http://10.0.0.7]1ac551c4,queue=0,pool=ConnectionPool[c=1/64,a=1,i=0]
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Created SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,R,-,1/0,HttpConnectionOverHTTP}{io=1,kio=0,kro=8}
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Running change org.eclipse.jetty.io.SelectChannelEndPoint$1@6ae8caa0
2016-09-25 16:41:14.377 [DEBUG] [lipse.jetty.io.SelectChannelEndPoint] - Key interests updated 0 → 1 on SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,R,-,1/0,HttpConnectionOverHTTP}{io=1,kio=1,kro=8}
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Selector loop waiting on select
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpChannel] - HttpExchange@63395c94 req=PENDING/null@null res=PENDING/null@null associated true to HttpChannelOverHTTP@141132a(exchange=HttpExchange@63395c94 req=PENDING/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=IDLE,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpSender ] - Request begin HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpSender ] - Request headers HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411
Accept-Encoding: gzip
User-Agent: Jetty/9.2.14.v20151106
Authorization: Basic YWRtaW46bW9rc2syNA==
Host: 10.0.0.7
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpContent] - Advanced content past last chunk
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.io.ChannelEndPoint] - flushed 156 SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,R,W,1/0,HttpConnectionOverHTTP}{io=1,kio=1,kro=8}
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpSender ] - Request committed HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpSender ] - Request success HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411
2016-09-25 16:41:14.377 [DEBUG] [rg.eclipse.jetty.client.HttpExchange] - Terminated request for HttpExchange@63395c94 req=TERMINATED/null@null res=PENDING/null@null, result: null
2016-09-25 16:41:14.377 [DEBUG] [org.eclipse.jetty.client.HttpSender ] - Terminating request HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411
2016-09-25 16:41:14.420 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Selector loop woken up from select, 1/1 selected
2016-09-25 16:41:14.421 [DEBUG] [lipse.jetty.io.SelectChannelEndPoint] - Key interests updated 1 → 0 on SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,R,-,43/0,HttpConnectionOverHTTP}{io=1,kio=0,kro=1}
2016-09-25 16:41:14.421 [DEBUG] [lipse.jetty.io.SelectChannelEndPoint] - Local interests updating 1 → 0 for SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,R,-,44/0,HttpConnectionOverHTTP}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.421 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Queued change org.eclipse.jetty.io.SelectChannelEndPoint$1@6ae8caa0
2016-09-25 16:41:14.421 [DEBUG] [.eclipse.jetty.io.AbstractConnection] - FILL_INTERESTED–>FILLING HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=false)[HttpChannelOverHTTP@141132a(exchange=HttpExchange@63395c94 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=START,0 of 0}]]]
2016-09-25 16:41:14.421 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Running change org.eclipse.jetty.io.SelectChannelEndPoint$1@6ae8caa0
2016-09-25 16:41:14.421 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Selector loop waiting on select
2016-09-25 16:41:14.421 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - parseNext s=START DirectByteBuffer@63886dda[p=0,l=0,c=16384,r=0]={<<<>>>HTTP/1.1 401 Unau…\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2016-09-25 16:41:14.422 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Parsed false, remaining 0 HttpParser{s=START,0 of 0}
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.io.ChannelEndPoint] - filled 610 SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,-,-,45/0,HttpConnectionOverHTTP}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.422 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Read 610 bytes DirectByteBuffer@63886dda[p=0,l=610,c=16384,r=610]={<<<HTTP/1.1 401 Unau…/body>\n\n>>>\xD1>g\xCd\xDca<TnjF@\xEdP9\xA0\x08…\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00} from SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,-,-,0/0,HttpConnectionOverHTTP}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - parseNext s=START DirectByteBuffer@63886dda[p=0,l=610,c=16384,r=610]={<<<HTTP/1.1 401 Unau…/body>\n\n>>>\xD1>g\xCd\xDca<TnjF@\xEdP9\xA0\x08…\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - START → RESPONSE_VERSION
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - RESPONSE_VERSION → SPACE1
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - SPACE1 → STATUS
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - STATUS → SPACE2
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - SPACE2 → REASON
2016-09-25 16:41:14.422 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - REASON → HEADER
2016-09-25 16:41:14.423 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Found protocol handler org.eclipse.jetty.client.WWWAuthenticationProtocolHandler@1f75d798
2016-09-25 16:41:14.423 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Response begin HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → HEADER_VALUE
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_VALUE → HEADER_IN_VALUE
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_IN_VALUE → HEADER
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → HEADER_IN_VALUE
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_IN_VALUE → HEADER
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → HEADER_VALUE
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_VALUE → HEADER_IN_VALUE
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_IN_VALUE → HEADER
2016-09-25 16:41:14.423 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → HEADER_IN_VALUE
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_IN_VALUE → HEADER
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → HEADER_VALUE
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_VALUE → HEADER_IN_VALUE
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_IN_VALUE → HEADER
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → HEADER_VALUE
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_VALUE → HEADER_IN_VALUE
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER_IN_VALUE → HEADER
2016-09-25 16:41:14.424 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - HEADER → CONTENT
2016-09-25 16:41:14.424 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Response headers HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927
WWW-Authenticate: Digest realm=“IPCamera Login”, nonce=“615d3ece647e7f10c4f3822c64237cbf”, qop=“auth”
Content-Type: text/html
Content-Length: 351
Connection: close
Date: Sun, 25 Sep 2016 13:41:10 GMT
Server: lighttpd/1.4.35
2016-09-25 16:41:14.425 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Response content HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927
DirectByteBufferR@6344bae7[p=259,l=610,c=16384,r=351]={HTTP/1.1 401 Unau…ttpd/1.4.35\r\n\r\n<<<<?xml version="1…/body>\n\n>>>\xD1>g\xCd\xDca<TnjF@\xEdP9\xA0\x08…\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2016-09-25 16:41:14.425 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - CONTENT → END
2016-09-25 16:41:14.425 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - reset HttpParser{s=END,351 of 351}
2016-09-25 16:41:14.425 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - END → CLOSED
2016-09-25 16:41:14.425 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Response success HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927
2016-09-25 16:41:14.425 [DEBUG] [rg.eclipse.jetty.client.HttpExchange] - Terminated response for HttpExchange@63395c94 req=TERMINATED/null@null res=TERMINATED/null@null, result: Result[HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411 > HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927] null
2016-09-25 16:41:14.425 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Response complete HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927
2016-09-25 16:41:14.425 [DEBUG] [org.eclipse.jetty.client.HttpChannel] - HttpExchange@63395c94 req=TERMINATED/null@null res=TERMINATED/null@null disassociated true from HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]
2016-09-25 16:41:14.426 [DEBUG] [.eclipse.jetty.client.ConnectionPool] - Connection removed HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=true)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]] - pooled: 0
2016-09-25 16:41:14.426 [DEBUG] [org.eclipse.jetty.io.ChannelEndPoint] - oshut SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,Open,in,out,-,-,4/0,HttpConnectionOverHTTP}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.426 [DEBUG] [y.client.http.HttpConnectionOverHTTP] - HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=true)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]] oshut
2016-09-25 16:41:14.426 [DEBUG] [rg.eclipse.jetty.io.AbstractEndPoint] - onClose SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,CLOSED,in,OSHUT,-,-,4/0,HttpConnectionOverHTTP}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.426 [DEBUG] [org.eclipse.jetty.io.ChannelEndPoint] - close SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,CLOSED,in,OSHUT,-,-,4/0,HttpConnectionOverHTTP}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.427 [DEBUG] [org.eclipse.jetty.io.SelectorManager] - Destroyed SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,CLOSED,ISHUT,OSHUT,-,-,5/0,HttpConnectionOverHTTP}{io=0,kio=-1,kro=-1}
2016-09-25 16:41:14.427 [DEBUG] [.eclipse.jetty.io.AbstractConnection] - onClose HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=true)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]]
2016-09-25 16:41:14.427 [DEBUG] [rg.eclipse.jetty.io.AbstractEndPoint] - onClose SelectChannelEndPoint@556322a2{/10.0.0.7:80<->57347,CLOSED,ISHUT,OSHUT,-,-,5/0,HttpConnectionOverHTTP}{io=0,kio=-1,kro=-1}
2016-09-25 16:41:14.427 [DEBUG] [y.client.http.HttpConnectionOverHTTP] - HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=true)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]] closed
2016-09-25 16:41:14.427 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Request/Response succeeded: Result[HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411 > HttpResponse[HTTP/1.1 401 Unauthorized]@6d834927] null
2016-09-25 16:41:14.427 [DEBUG] [client.AuthenticationProtocolHandler] - No authentication available for HttpRequest[GET /mjpeg/snap.cgi HTTP/1.1]@48666411
2016-09-25 16:41:14.428 [DEBUG] [ent.util.InputStreamResponseListener] - Queuing [60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 105, 115, 111, 45, 56, 56, 53, 57, 45, 49, 34, 63, 62, 10, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, 109, 108, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 88, 72, 84, 77, 76, 32, 49, 46, 48, 32, 84, 114, 97, 110, 115, 105, 116, 105, 111, 110, 97, 108, 47, 47, 69, 78, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 84, 82, 47, 120, 104, 116, 109, 108, 49, 47, 68, 84, 68, 47, 120, 104, 116, 109, 108, 49, 45, 116, 114, 97, 110, 115, 105, 116, 105, 111, 110, 97, 108, 46, 100, 116, 100, 34, 62, 10, 60, 104, 116, 109, 108, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 104, 116, 109, 108, 34, 32, 120, 109, 108, 58, 108, 97, 110, 103, 61, 34, 101, 110, 34, 32, 108, 97, 110, 103, 61, 34, 101, 110, 34, 62, 10, 32, 60, 104, 101, 97, 100, 62, 10, 32, 32, 60, 116, 105, 116, 108, 101, 62, 52, 48, 49, 32, 45, 32, 85, 110, 97, 117, 116, 104, 111, 114, 105, 122, 101, 100, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 60, 47, 104, 101, 97, 100, 62, 10, 32, 60, 98, 111, 100, 121, 62, 10, 32, 32, 60, 104, 49, 62, 52, 48, 49, 32, 45, 32, 85, 110, 97, 117, 116, 104, 111, 114, 105, 122, 101, 100, 60, 47, 104, 49, 62, 10, 32, 60, 47, 98, 111, 100, 121, 62, 10, 60, 47, 104, 116, 109, 108, 62, 10]/351 bytes
2016-09-25 16:41:14.428 [DEBUG] [ent.util.InputStreamResponseListener] - Queuing end of content
2016-09-25 16:41:14.428 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - Parsed false, remaining 0 HttpParser{s=CLOSED,351 of 351}
2016-09-25 16:41:14.428 [DEBUG] [ent.util.InputStreamResponseListener] - Dequeued [60, 63, 120, 109, 108, 32, 118, 101, 114, 115, 105, 111, 110, 61, 34, 49, 46, 48, 34, 32, 101, 110, 99, 111, 100, 105, 110, 103, 61, 34, 105, 115, 111, 45, 56, 56, 53, 57, 45, 49, 34, 63, 62, 10, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, 109, 108, 32, 80, 85, 66, 76, 73, 67, 32, 34, 45, 47, 47, 87, 51, 67, 47, 47, 68, 84, 68, 32, 88, 72, 84, 77, 76, 32, 49, 46, 48, 32, 84, 114, 97, 110, 115, 105, 116, 105, 111, 110, 97, 108, 47, 47, 69, 78, 34, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 84, 82, 47, 120, 104, 116, 109, 108, 49, 47, 68, 84, 68, 47, 120, 104, 116, 109, 108, 49, 45, 116, 114, 97, 110, 115, 105, 116, 105, 111, 110, 97, 108, 46, 100, 116, 100, 34, 62, 10, 60, 104, 116, 109, 108, 32, 120, 109, 108, 110, 115, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 120, 104, 116, 109, 108, 34, 32, 120, 109, 108, 58, 108, 97, 110, 103, 61, 34, 101, 110, 34, 32, 108, 97, 110, 103, 61, 34, 101, 110, 34, 62, 10, 32, 60, 104, 101, 97, 100, 62, 10, 32, 32, 60, 116, 105, 116, 108, 101, 62, 52, 48, 49, 32, 45, 32, 85, 110, 97, 117, 116, 104, 111, 114, 105, 122, 101, 100, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 60, 47, 104, 101, 97, 100, 62, 10, 32, 60, 98, 111, 100, 121, 62, 10, 32, 32, 60, 104, 49, 62, 52, 48, 49, 32, 45, 32, 85, 110, 97, 117, 116, 104, 111, 114, 105, 122, 101, 100, 60, 47, 104, 49, 62, 10, 32, 60, 47, 98, 111, 100, 121, 62, 10, 60, 47, 104, 116, 109, 108, 62, 10]/351 bytes
2016-09-25 16:41:14.428 [DEBUG] [rg.eclipse.jetty.client.HttpReceiver] - HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=true)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]] closed
2016-09-25 16:41:14.428 [DEBUG] [ent.util.InputStreamResponseListener] - Dequeued /0 bytes
2016-09-25 16:41:14.428 [DEBUG] [.eclipse.jetty.server.HttpConnection] - org.eclipse.jetty.server.HttpConnection$SendCallback@4192a0bc[PROCESSING][i=ResponseInfo{HTTP/1.1 200 null,351,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@315fb0a7] generate: NEED_HEADER (null,[p=0,l=351,c=4096,r=351],true)@START
2016-09-25 16:41:14.428 [DEBUG] [.eclipse.jetty.io.AbstractConnection] - FILLING–>IDLE HttpConnectionOverHTTP@3b37d0d2(l:/192.168.1.222:57347 ↔ r:/10.0.0.7:80,closed=true)[HttpChannelOverHTTP@141132a(exchange=null)[send=HttpSenderOverHTTP@23e67625(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator{s=START}],recv=HttpReceiverOverHTTP@6fdc26c9(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,351 of 351}]]]
2016-09-25 16:41:14.428 [DEBUG] [.eclipse.jetty.server.HttpConnection] - org.eclipse.jetty.server.HttpConnection$SendCallback@4192a0bc[PROCESSING][i=ResponseInfo{HTTP/1.1 200 null,351,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@315fb0a7] generate: FLUSH ([p=0,l=249,c=8192,r=249],[p=0,l=351,c=4096,r=351],true)@COMPLETING
2016-09-25 16:41:14.428 [DEBUG] [org.eclipse.jetty.io.ChannelEndPoint] - flushed 600 SelectChannelEndPoint@28dd0654{/192.168.1.105:6036<->8080,Open,in,out,-,W,131/30000,HttpConnection}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.429 [DEBUG] [.eclipse.jetty.server.HttpConnection] - org.eclipse.jetty.server.HttpConnection$SendCallback@4192a0bc[PROCESSING][i=ResponseInfo{HTTP/1.1 200 null,351,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@315fb0a7] generate: SHUTDOWN_OUT ([p=249,l=249,c=8192,r=0],[p=351,l=351,c=4096,r=0],true)@END
2016-09-25 16:41:14.429 [DEBUG] [.eclipse.jetty.server.HttpConnection] - org.eclipse.jetty.server.HttpConnection$SendCallback@4192a0bc[PROCESSING][i=ResponseInfo{HTTP/1.1 200 null,351,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@315fb0a7] generate: DONE ([p=249,l=249,c=8192,r=0],[p=351,l=351,c=4096,r=0],true)@END
2016-09-25 16:41:14.429 [DEBUG] [org.eclipse.jetty.io.ChannelEndPoint] - oshut SelectChannelEndPoint@28dd0654{/192.168.1.105:6036<->8080,Open,in,out,-,-,1/30000,HttpConnection}{io=0,kio=0,kro=1}
2016-09-25 16:41:14.429 [DEBUG] [ent.util.InputStreamResponseListener] - Queuing close
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ o.e.j.s.h.ContextHandler@2a5f0ad0{/static,null,AVAILABLE}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=com.eclipsesource.jaxrs.publisher_5.3.1.201602281253 [11], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.eclipse.smarthome.ui.icon_0.9.0.b1 [131], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=org.jupnp.transport.impl.osgi.DisableAuthenticationHttpContext@8dc3052}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.eclipse.smarthome.ui.basic_0.9.0.b1 [179], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.eclipse.smarthome.ui.classic_0.9.0.b1 [180], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.eclipse.smarthome.ui.paper_0.9.0.b1 [181], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.openhab.io.rest.docs_2.0.0.b4 [182], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.openhab.ui.dashboard_2.0.0.b4 [185], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [.jetty.server.handler.ContextHandler] - scope null||/proxy @ HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.openhab.core_2.0.0.b4 [161], contextID=default]}
2016-09-25 16:41:14.429 [DEBUG] [org.eclipse.jetty.server.Server ] - RESPONSE /proxy 200 handled=true
2016-09-25 16:41:14.429 [DEBUG] [clipse.jetty.server.HttpChannelState] - HttpChannelState@70b669fd{s=DISPATCHED i=true a=null} unhandle DISPATCHED
2016-09-25 16:41:14.429 [DEBUG] [org.eclipse.jetty.http.HttpParser ] - close HttpParser{s=END,0 of -1}

Interesting thing is that the url

http://admin:password@10.0.0.7/mjpeg/snap.cgi?chn=1

(image is loaded) is working from Chrome and Firefox but not from Edge.

Only webkit browsers (chrome, firefox) are fully supported …

Just to clarify.

When going directly to url that has the image it is visble with in Chrome, Firefox and also I’m able to get the image with wget.

But when having this same URL as Image in Sitemap it is not working. It is not working for any brower.

I have other images working, but for those I don’t need the Basic Authentication.

Also the URL worked with openhab2 beta3.

I have also browsed openahab code, but I was not able to find any hint why this is not working.

Hi!

I’m not sure if this should be a separate thread, but let’s see.
I discover exactly the same problem here (sitemap:image via proxy, working without authentication, not working with authentication). openHAB2-Snapshot from today (based on b4).

But: In my case the camera (which serves the images) wants Digest-Authentication, not Basic Authentication like in the example above. I suspect this could be a problem, as the OH proxy might only have an implementation for Basic-Authentication.

Btw: the test with wget as seen above is misleading, because wget does an “ordinary” request first (-> 401 with “WWW-Authenticate: Digest …” Header in response) and sends a correct “Authorization: Digest …” Header in a second request. You can see this with wget -d.

Maybe this is the way to go for the proxy (as does a browser, imho):

  • send request without authentication
  • handle 401 according to Response-Header
  • send second request with correct authentication method

Greetings,
Andi

1 Like

Thanks @aliebrich,

yes this was my bad. I was making assumptions that camera was using Basic authetication, but it was actually using Digest-Atuhentication.

So we have a common issue.

Just quickly checked the code for ProxyServlet and there was action Replaced Apache HttpClient 3.x with Jetty.

It seems that after this change digest authentication is no more working, because it only handles the basic authentication.

Not so familiar how to raise issues in git. Is this something that should be raised as bug?

Yes, I think it should be raised as a bug. I already thought about this, cause this “plain header handling” is not the best solution, (jetty) HttpClient offers smarter solutions for this.

But:
I will hold it back for a short time, because while testing my proposed solution i stumbled upon another bug in jetty HttpClient. :unamused:
https://github.com/eclipse/jetty.project/issues/1078 (sorry, some silly “link limit” keeps biting me)
… hm… while typing this the bug got already fixed, only some hours later. Impressive.

I’ll check it out and look where it will be made available, after that I’ll open an issue with openHAB.

Greetz,
Andi

Hello @aliebrich,

Have you had time to check this? I’m about to buy a new camera and wondering that if I should buy one that only supports the digest authentication…

To access your IP camera’s image or video stream with embedded username:password in the URL from Basic UI, Classic UI or mobile apps, the image or video is funnelled through the proxy servlet so it can be viewed outside of your local network (like via the myopenhab service).

The proxy servlet does not actually negotiate WWW authentication (Basic or Digest), but instead assumes Basic authentication and adds an HTTP header for Basic authentication before even submitting the GET request. When that is the correct choice, the far end device does not respond with an HTTP 401 response code, but instead accepts the authentication and returns the data. When the far end device insists on Digest authentication, you hit a problem. I have a TP-Link NC220 camera that requests Digest authentication through normal use, but when it receives the Basic authentication header as delivered by the proxy servlet, it accepts it anyway and works. I imagine that many other cameras won’t work this way.

The preferable approach would be to negotiate the kind of authentication that the far end device wants, but it’s pretty tricky to act as both a proxy and something that fully negotiates WWW Authentication transparently to the requester. I was making an effort at that over the last days, but no joy yet.

Hi John!

Sorry i had no time to look into this again earlier. As you stated above, the problem still exists, but can imho also be resolved easily.

As you write, the proxy servlet assumes Basic Auth and this is the exact problem.
I think there’s no need in trying to negotiate things manually or something alike. In Jetty HttpClient there’s an automatic fallback from Digest to Basic Auth, if you just let Jetty handle this stuff.
Since my last posts the Eclipse Smarthome code changed a bit ({Async,Blocking}ProxyServlet delegating the authentication stuff to ProxyServletService#maybeAppendAuthHeader, but the solution should be simple (as you can see in above linked Jetty issue, which should have found it’s way into eclipse smarthome in the meantime, i hope):

AuthenticationStore authenticationStore = httpClient.getAuthenticationStore();
authenticationStore.addAuthentication(new DigestAuthentication(uri, ANY_REALM, user, password));

This DigestAuthentication does all the magic, with included fallback to Basic Auth.

Am i completely wrong here, and it looks too simple for me?

I wouldn’t bother to try it myself so i could create a PR, if i only didn’t have such an aversion to OSGi…

For me with openhab 2.2 and 2.3 image view for ip cameras (Trendnet) was definitely not working anymore, as digest authentication is not supported in newer versions.

As a workaround I have found this nice php-Script, that i integreted in the nginx-proxy-server (Basic authentication enabled as for openhab)

<?php
/* IP Camera Proxy
 * PHP frontend to interface with cheap password-protected webcams and 
 * pull images for public display on a website
 * 
 * Copyright Will Bradley, 2012 (www.zyphon.com)
 * Distributed under a Creative Commons Attribution 3.0 license
 * http://creativecommons.org/licenses/by/3.0/
 *
 * To use, change EXAMPLE.COM, the port number, EXAMPLEUSER, & EXAMPLEPASSWORD
 * to their correct values for your setup. I use cheap Hootoo-brand cameras
 * for my setup, yours may be different regarding snapshot urls and auth
 * mechanisms. Then, host this on a PHP site and access it at 
 * /snapshot.php?camera=1
 * 
 */

if($_GET['camera'] == 1) 
{
	$url = 'http://#IPadresse#:80/image/jpeg.cgi';  // remember there needs to be a ? between the URL and the random number. Don't remove the question mark.
	
	$curl_handle=curl_init();
	curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($curl_handle,CURLOPT_URL,$url); 
	curl_setopt($curl_handle, CURLOPT_USERPWD, "user:password");
  	curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); 
	$buffer = curl_exec($curl_handle);
	curl_close($curl_handle);
	
	if (empty($buffer))
	{
	    print "";
	}
	elseif($buffer == "Can not get image.")
	{
	    print "Can not get image.";
	}
	else
	{
	    header("Content-Type: image/jpeg");
	    print $buffer;
	}
}
elseif($_GET['camera'] == 2) 
{
	$url = 'http://#IPadresse#:80/image/jpeg.cgi';  // remember there needs to be a ? between the URL and the random number.  Don't remove the question mark.
	
	$curl_handle=curl_init();
	curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($curl_handle,CURLOPT_URL,$url); 
	curl_setopt($curl_handle, CURLOPT_USERPWD, "user:password");
 	curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); 
	$buffer = curl_exec($curl_handle);
	curl_close($curl_handle);
	
	if (empty($buffer))
	{
	    print "";
	}
	elseif($buffer == "Can not get image.")
	{
	    print "Can not get image.";
	}
	else
	{
	    header("Content-Type: image/jpeg");
	    print $buffer;
	}
}
elseif($_GET['camera'] == 3) 
{
	$url = 'http://#IPadresse#:80/Streaming/channels/1/picture';  // remember there needs to be a ? between the URL and the random number. Don't remove the question mark.
	
	$curl_handle=curl_init();
	curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($curl_handle,CURLOPT_URL,$url); 
	curl_setopt($curl_handle, CURLOPT_USERPWD, "user:password");
	$buffer = curl_exec($curl_handle);
	curl_close($curl_handle);
	
	if (empty($buffer))
	{
	    print "1";
	}
	elseif($buffer == "Can not get image.")
	{
	    print "Can not get image.";
	}
	else
	{
	    header("Content-Type: image/jpeg");
	    print $buffer;
	}
}
elseif($_GET['camera'] == 4) 
{
	$url = 'http://#IPadresse#:80/Streaming/channels/1/picture';  // remember there needs to be a ? between the URL and the random number. Don't remove the question mark.
	
	$curl_handle=curl_init();
	curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($curl_handle,CURLOPT_URL,$url); 
	curl_setopt($curl_handle, CURLOPT_USERPWD, "user:password");
	$buffer = curl_exec($curl_handle);
	curl_close($curl_handle);
	
	if (empty($buffer))
	{
	    print "";
	}
	elseif($buffer == "Can not get image.")
	{
	    print "Can not get image.";
	}
	else
	{
	    header("Content-Type: image/jpeg");
	    print $buffer;
	}
}
elseif($_GET['camera'] == 5) 
{
	$url = 'http://#IPadresse#:80/Streaming/channels/1/picture';  // remember there needs to be a ? between the URL and the random number. Don't remove the question mark.
	
	$curl_handle=curl_init();
	curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($curl_handle,CURLOPT_URL,$url); 
	curl_setopt($curl_handle, CURLOPT_USERPWD, "user:password");
	$buffer = curl_exec($curl_handle);
	curl_close($curl_handle);
	
	if (empty($buffer))
	{
	    print "";
	}
	elseif($buffer == "Can not get image.")
	{
	    print "Can not get image.";
	}
	else
	{
	    header("Content-Type: image/jpeg");
	    print $buffer;
	}
}
else 
{
	print "Error: No camera requested.";
}

?>

Can someone open an issue in Git explaning that the proxy is not supporting digest authentication ?

I’m using your script, and from a browser I can see the image, but not from sitemap in basicUI

Did you do anything else ?

Here is my sitemap entry:
Image url=“http://192.168.0.9/Camera.php?camera=1

To be both a proxy and to negotiate digest authentication n’est pas façile. It would be nice for someone to figure that one out along with test cases, but I suspect it’s asking too much. See this message:

The proxy servlet does not actually negotiate WWW authentication (Basic or Digest), but instead assumes Basic authentication and adds an HTTP header for Basic authentication before even submitting the GET request. When that is the correct choice, the far end device does not respond with an HTTP 401 response code, but instead accepts the authentication and returns the data. When the far end device insists on Digest authentication, you hit a problem [because digest authentication requires a dialogue between client and server].

What about @aliebrich code proposal ?
@watou: isn’t it the solution?

Such wasn’t working when I rewrote/refactored the proxy servlet (the 401 response was proxied instead of handled iirc) but it’s possible something has changed in later Jetty releases since that was over a year ago. Good luck fixing it (in both async and blocking implementations) and including test cases so as not to introduce regressions.