net7mma-111009 - Unauthorized (.Net 4.0)

Topics: Question
Mar 10, 2015 at 10:08 AM
The problem in the latest version.
Log in RtspInspector:

@10.03.2015 10:02:04 - OPTIONS rtsp://192.168.168.163:554/ RTSP/1.0
CSeq: 1
@10.03.2015 10:02:04 - OPTIONS rtsp://192.168.168.163:554/ RTSP/1.0
CSeq: 1
@10.03.2015 10:02:05 - RTSP/1.0 401 Unauthorized
@10.03.2015 10:02:05 - DESCRIBE rtsp://192.168.168.163:554/ RTSP/1.0
Accept: application/sdp
CSeq: 2
@10.03.2015 10:02:05 - DESCRIBE rtsp://192.168.168.163:554/ RTSP/1.0
Accept: application/sdp
CSeq: 2
@10.03.2015 10:02:05 - RTSP/1.0 401 Unauthorized

In version net7mma-110929 is ok.
@10.03.2015 10:07:22 - OPTIONS rtsp://192.168.168.163/ RTSP/1.0
User-Agent: ASTI RTP Client
Content-Encoding: Unicode (UTF-8)
Date: Tue, 10 Mar 2015 10:07:22 GMT
CSeq: 1
Timestamp: 1.4030803


@10.03.2015 10:07:22 - OPTIONS rtsp://192.168.168.163/ RTSP/1.0
User-Agent: ASTI RTP Client
Content-Encoding: Unicode (UTF-8)
Date: Tue, 10 Mar 2015 10:07:22 GMT
CSeq: 1
Timestamp: 1.4030803
Authorization: Basic YWRtaW46YWRtaW4=


@10.03.2015 10:07:22 - OPTIONS rtsp://192.168.168.163/ RTSP/1.0
User-Agent: ASTI RTP Client
Content-Encoding: Unicode (UTF-8)
Date: Tue, 10 Mar 2015 10:07:22 GMT
CSeq: 1
Timestamp: 1.4030803
Authorization: Basic YWRtaW46YWRtaW4=


@10.03.2015 10:07:22 - RTSP/1.0 200 OK
Server: Rtsp Server/2.0
CSeq: 1
Public: OPTIONS,DESCRIBE,SETUP,PLAY,PAUSE,TEARDOWN,SET_PARAMETER,GET_PARAMETER
...
Coordinator
Mar 10, 2015 at 1:03 PM
Hello and thanks for using the library.

I am aware of only an issue with digest authorization and only with certain cameras which I have recently fixed but did not get a chance to update the code yet.

How is the rtsp client being created? Can you show the values you pass to the constructor?

Also what is the value of SocketReadTimeout set to?

Thanks!
Marked as answer by juliusfriedman on 3/10/2015 at 6:03 AM
Mar 10, 2015 at 1:24 PM
I found bug.
Method ParseHeaders(bool force = false) generate exception "Cannot access a closed stream" with reference to variable m_Buffer.
Stream m_Buffer closes in the Method ReadDelimitedDataFrom(...):
using(var br = new System.IO.BinaryReader(stream, encoding))
{
...
}

using disposable strem br and m_Buffer.

I fixed code on:
var br = new System.IO.BinaryReader(stream, encoding);
{
...
}
br.Close();
br=null;

Maybe error due to the use of .Net Framework 4.0 and VS2010?

Thank you for your work.
Coordinator
Mar 10, 2015 at 1:35 PM
Edited Mar 10, 2015 at 1:35 PM
Yes, because in 4.0 there was no 'leaveOpen' parameter.

You should be using 4.5.2 anway :-D

That may also resolve your other issue.

Let me know if you need anything else.
Marked as answer by juliusfriedman on 3/10/2015 at 6:35 AM