rtsp: Clear the session id on redirects

Message ID 1411547598-5390-1-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Sept. 24, 2014, 8:33 a.m.
This fixes handling redirects in case the server provided a session
id within the redirect reply.
---
 libavformat/rtsp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Luca Barbato Sept. 24, 2014, 9:25 a.m. | #1
On 24/09/14 10:33, Martin Storsjö wrote:
> This fixes handling redirects in case the server provided a session
> id within the redirect reply.
> ---
>  libavformat/rtsp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 23d7da1..646712e 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1812,6 +1812,7 @@ redirect:
>      ff_rtsp_close_connections(s);
>      if (reply->status_code >=300 && reply->status_code < 400 && s->iformat) {
>          av_strlcpy(s->filename, reply->location, sizeof(s->filename));
> +        rt->session_id[0] = '\0';
>          av_log(s, AV_LOG_INFO, "Status %d: Redirecting to %s\n",
>                 reply->status_code,
>                 s->filename);
> 

Should be backported to the release branches?
Martin Storsjö Sept. 24, 2014, 9:37 a.m. | #2
On Wed, 24 Sep 2014, Luca Barbato wrote:

> On 24/09/14 10:33, Martin Storsjö wrote:
>> This fixes handling redirects in case the server provided a session
>> id within the redirect reply.
>> ---
>>  libavformat/rtsp.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>> index 23d7da1..646712e 100644
>> --- a/libavformat/rtsp.c
>> +++ b/libavformat/rtsp.c
>> @@ -1812,6 +1812,7 @@ redirect:
>>      ff_rtsp_close_connections(s);
>>      if (reply->status_code >=300 && reply->status_code < 400 && s->iformat) {
>>          av_strlcpy(s->filename, reply->location, sizeof(s->filename));
>> +        rt->session_id[0] = '\0';
>>          av_log(s, AV_LOG_INFO, "Status %d: Redirecting to %s\n",
>>                 reply->status_code,
>>                 s->filename);
>>
>
> Should be backported to the release branches?

Was this an implicit ok? :-)

As for backporting, maybe - sure, it's a fix but it's also a behaviour 
change (theoretically this might actually break some really odd server), 
so I'd wait a little at least to let it live in master for a while first.

// Martin
Luca Barbato Sept. 24, 2014, 9:38 a.m. | #3
On 24/09/14 11:37, Martin Storsjö wrote:
> On Wed, 24 Sep 2014, Luca Barbato wrote:
>
>> On 24/09/14 10:33, Martin Storsjö wrote:
>>> This fixes handling redirects in case the server provided a session
>>> id within the redirect reply.
>>> ---
>>>  libavformat/rtsp.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>>> index 23d7da1..646712e 100644
>>> --- a/libavformat/rtsp.c
>>> +++ b/libavformat/rtsp.c
>>> @@ -1812,6 +1812,7 @@ redirect:
>>>      ff_rtsp_close_connections(s);
>>>      if (reply->status_code >=300 && reply->status_code < 400 &&
>>> s->iformat) {
>>>          av_strlcpy(s->filename, reply->location, sizeof(s->filename));
>>> +        rt->session_id[0] = '\0';
>>>          av_log(s, AV_LOG_INFO, "Status %d: Redirecting to %s\n",
>>>                 reply->status_code,
>>>                 s->filename);
>>>
>>
>> Should be backported to the release branches?
>
> Was this an implicit ok? :-)
>
> As for backporting, maybe - sure, it's a fix but it's also a behaviour
> change (theoretically this might actually break some really odd server),
> so I'd wait a little at least to let it live in master for a while first.
>

Let's do that then =)

lu

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 23d7da1..646712e 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1812,6 +1812,7 @@  redirect:
     ff_rtsp_close_connections(s);
     if (reply->status_code >=300 && reply->status_code < 400 && s->iformat) {
         av_strlcpy(s->filename, reply->location, sizeof(s->filename));
+        rt->session_id[0] = '\0';
         av_log(s, AV_LOG_INFO, "Status %d: Redirecting to %s\n",
                reply->status_code,
                s->filename);