[FFmpeg-devel] [PATCH] avformat/http: ignore the string after char '#'

Liu Steven lq at chinaffmpeg.org
Thu Jan 10 05:11:03 EET 2019



> 在 2019年1月9日,下午9:26,Nicolas George <george at nsup.org> 写道:
> 
> Steven Liu (12019-01-09):
>> fix ticket: 7660
>> Because the char '#' is used for webbrowser to display, it won't present
>> in URI of http request.
>> 
>> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
>> ---
>> libavformat/utils.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index 7afef545fe..f93837a805 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -4731,6 +4731,7 @@ void av_url_split(char *proto, int proto_size,
>>                   int *port_ptr, char *path, int path_size, const char *url)
>> {
>>     const char *p, *ls, *ls2, *at, *at2, *col, *brk;
>> +    char *bp;
>> 
>>     if (port_ptr)
>>         *port_ptr = -1;
>> @@ -4758,6 +4759,9 @@ void av_url_split(char *proto, int proto_size,
>>     }
>> 
>>     /* separate path from hostname */
>> +    bp = strchr(p, '#');
>> +    if (bp)
>> +        *bp = '\0';
>>     ls = strchr(p, '/');
>>     ls2 = strchr(p, '?');
>>     if (!ls)
> 
> This invalid: p points either to url, which is const, or to NULL.
> 
> Also, I do not think the fix itself is correct: the fragment part should
> not have arrived there in the first place.

Hi Nicolas,

    How should i understand the mean “the fragment part should not have arrived there in the first place.” ?

    When i use wget to get http://ffmpeg.org/helloworld/test#hello=24
    wget -dS http://ffmpeg.org/helloworld/test#hello=24
    the request is GET /helloworld/test

    But ffmpeg is use full URI “/helloworld/test#hello=24”
    That will forbidden by the http server in ticket: 7660.
     
    or just fix it in hls.c?


Thanks
Steven

> 
> Regards;
> 
> -- 
>  Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel





More information about the ffmpeg-devel mailing list