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

Steven Liu lq at chinaffmpeg.org
Wed Jan 9 08:24:50 EET 2019


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)
-- 
2.15.2 (Apple Git-101.1)





More information about the ffmpeg-devel mailing list