summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-03-25 21:49:43 +0000
committerMartin Storsjö <martin@martin.st>2010-03-25 21:49:43 +0000
commit30af077942478b71823d4d04aeed2b8889e92c65 (patch)
tree9511c7751d51b56793010dede6686e34051d9c32
parent2626308abb1dc59afa9a9b36cf767ea6823b6cf2 (diff)
Don't force basic auth in RTSP, but retry with the server-specified method on failure
Originally committed as revision 22678 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/rtsp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f0ec5982ad..fd6112e9b0 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1060,10 +1060,19 @@ void ff_rtsp_send_cmd_with_content(AVFormatContext *s,
const unsigned char *send_content,
int send_content_length)
{
+ RTSPState *rt = s->priv_data;
+ HTTPAuthType cur_auth_type;
+
+retry:
+ cur_auth_type = rt->auth_state.auth_type;
ff_rtsp_send_cmd_with_content_async(s, method, url, header,
send_content, send_content_length);
ff_rtsp_read_reply(s, reply, content_ptr, 0);
+
+ if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE &&
+ rt->auth_state.auth_type != HTTP_AUTH_NONE)
+ goto retry;
}
/**
@@ -1447,7 +1456,6 @@ redirect:
host, sizeof(host), &port, path, sizeof(path), s->filename);
if (*auth) {
av_strlcpy(rt->auth, auth, sizeof(rt->auth));
- rt->auth_state.auth_type = HTTP_AUTH_BASIC;
}
if (port < 0)
port = RTSP_DEFAULT_PORT;