cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Query regarding RTSP authentication

From: <jeremy_at_fastmail.co.uk>
Date: Fri, 30 Dec 2011 16:44:44 +0000

On Fri, Dec 30, 2011, at 16:31, Daniel Stenberg wrote:
> On Fri, 30 Dec 2011, jeremy_at_fastmail.co.uk wrote:
>
> > After scouring the examples and archives for inspiration I came across a
> > mail titled '[PATCH] RTSP-Authentication'
> > (http://curl.haxx.se/mail/lib-2011-06/0004.html). I promptly applied the
> > patch from the mailing list and libcurl started handling RTSP
> > authentication. Question is, will this patch be making it's way into a
> > libcurl release?
>
> It fell off my radar and I had some concerns I don't quite recall the
> details
> of. Are you saying the concerns I brought up are all fine?
>

On Fri, 17 Jun 2011, Daniel Stenberg wrote:
> On Thu, 16 Jun 2011, Jim Hollinger wrote
> > You are correct, this mod did not come from a specification, but from
> > operational experience. When negotiating an RTSP connection to several video
> > servers and ip cameras, I found the curl_easy_perform() call will not return
> > from the DESCRIBE request until it times-out if authentication fails.
>
> > This is because the curl function expects the sdp content to be returned as
> > the body of the response, but this content is not transmitted by the server
> > if the client authentication fails.
>
> Wow. That sounds terribly broken. Have you checked what (other) RTSP clients
> do for these cases?
>
> Can you show us the full set of headers such a typical RTSP server responds
> with if the auth fails? Are you saying that it reports that there's a
> content-length etc but it doesn't actually send that data?

You will have to excuse my ignorance as libcurl and studying RFCs is a
relatively new past time. Your concerns seemed to be with the behaviour
of RTSP servers that send a 401 response. Below is a wireshark trace of
an RTSP conversation between vlc and an Axis camera. As far as I can
understand libcurl expects a SDP response from a Describe request,
however because authentication failed the server does not return the SDP
data or set Content-Length etc, thus stalemate. From my basic testing
the patch makes libcurl handle the Describe request in a similar fashion
to vlc.

OPTIONS rtsp://192.168.0.4/mpeg4/1/media.amp RTSP/1.0
CSeq: 1
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER,
TEARDOWN

DESCRIBE rtsp://192.168.0.4/mpeg4/1/media.amp RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Digest realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af", stale=FALSE
WWW-Authenticate: Basic realm="AXIS_00408C6596D6"

DESCRIBE rtsp://192.168.0.4/mpeg4/1/media.amp RTSP/1.0
CSeq: 3
Accept: application/sdp
Authorization: Digest username="root", realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af",
uri="rtsp://192.168.0.4/mpeg4/1/media.amp",
response="9d601434de8132b3a5f02c3649f25f05"
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.0.4:554/mpeg4/1/media.amp/
Content-Type: application/sdp
Content-Length: 698
v=0
o=- 947127225043130 947127225043138 IN IP4 192.168.0.4
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:8000
t=0 0
a=control:*
a=range:npt=now-
a=mpeg4-iod:
"data:application/mpeg4-iod;base64,AoDUAE8BAf/1AQOAbwABQFBkYXRhOmFwcGxpY2F0aW9uL21wZWc0LW9kLWF1O2Jhc2U2NCxBUjBCR3dVZkF4Y0F5U1FBWlFRTklCRUVrK0FBZWhJQUFIb1NBQVlCQkE9PQQNAQUABAAAAAAAAAAAAAYJAQAAAAAAAAAAAzoAAkA2ZGF0YTphcHBsaWNhdGlvbi9tcGVnNC1iaWZzLWF1O2Jhc2U2NCx3QkFTWVFTSVVFVUZQd0E9BBICDQAAAgAAAAAAAAAABQMAAEAGCQEAAAAAAAAAAA=="
m=video 0 RTP/AVP 96
b=AS:8000
a=framerate:30.0
a=control:trackID=1
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=245;
config=000001B0F5000001B509000001000000012008D49588032516044814440F
a=mpeg4-esid:201
SETUP rtsp://192.168.0.4:554/mpeg4/1/media.amp/trackID=1 RTSP/1.0
CSeq: 4
Transport: RTP/AVP;unicast;client_port=34996-34997
Authorization: Digest username="root", realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af",
uri="rtsp://192.168.0.4:554/mpeg4/1/media.amp/",
response="2eae467d03d178ee1fecf640f1e0affb"
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 4
Session: 1797559597;timeout=60
Transport:
RTP/AVP;unicast;client_port=34996-34997;server_port=50020-50021;ssrc=4D03E67E;mode="PLAY"

PLAY rtsp://192.168.0.4:554/mpeg4/1/media.amp/ RTSP/1.0
CSeq: 5
Session: 1797559597
Range: npt=0.000-
Authorization: Digest username="root", realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af",
uri="rtsp://192.168.0.4:554/mpeg4/1/media.amp/",
response="e9c65ca08356efa06d3272d5549a75f9"
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 5
Session: 1797559597
Range: npt=now-
RTP-Info: url=trackID=1;seq=28083;rtptime=3032983193

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-30