summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-03-25 21:48:58 +0000
committerMartin Storsjö <martin@martin.st>2010-03-25 21:48:58 +0000
commit2626308abb1dc59afa9a9b36cf767ea6823b6cf2 (patch)
treed9c48477d0debe8d8496ddd6b5d14d14cd0a41e6
parentaa8bf2fb8062880e02c0b8ffeb3bd5fce0753733 (diff)
Actually parse the auth headers in RTSP
Originally committed as revision 22677 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffserver.c2
-rw-r--r--libavformat/rtsp.c11
-rw-r--r--libavformat/rtsp.h3
3 files changed, 12 insertions, 4 deletions
diff --git a/ffserver.c b/ffserver.c
index bebb87c0aa..37b9a8ee1d 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2756,7 +2756,7 @@ static int rtsp_parse_request(HTTPContext *c)
len = sizeof(line) - 1;
memcpy(line, p, len);
line[len] = '\0';
- ff_rtsp_parse_line(header, line);
+ ff_rtsp_parse_line(header, line, NULL);
p = p1 + 1;
}
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 231795a31f..f0ec5982ad 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -838,7 +838,8 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
}
}
-void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf)
+void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
+ HTTPAuthState *auth_state)
{
const char *p;
@@ -871,6 +872,12 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf)
} else if (av_stristart(p, "Location:", &p)) {
skip_spaces(&p);
av_strlcpy(reply->location, p , sizeof(reply->location));
+ } else if (av_stristart(p, "WWW-Authenticate:", &p) && auth_state) {
+ skip_spaces(&p);
+ ff_http_auth_handle_header(auth_state, "WWW-Authenticate", p);
+ } else if (av_stristart(p, "Authentication-Info:", &p) && auth_state) {
+ skip_spaces(&p);
+ ff_http_auth_handle_header(auth_state, "Authentication-Info", p);
}
}
@@ -951,7 +958,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
get_word(buf1, sizeof(buf1), &p);
reply->status_code = atoi(buf1);
} else {
- ff_rtsp_parse_line(reply, p);
+ ff_rtsp_parse_line(reply, p, &rt->auth_state);
av_strlcat(rt->last_reply, p, sizeof(rt->last_reply));
av_strlcat(rt->last_reply, "\n", sizeof(rt->last_reply));
}
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index e9625bc65d..2c0be087aa 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -322,7 +322,8 @@ typedef struct RTSPStream {
//@}
} RTSPStream;
-void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf);
+void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
+ HTTPAuthState *auth_state);
#if LIBAVFORMAT_VERSION_INT < (53 << 16)
extern int rtsp_default_protocols;