diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2007-10-18 09:50:53 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2007-10-18 09:50:53 +0000 |
commit | c5be140c9ada97e754cf95ffd26ac6cd5192f770 (patch) | |
tree | 16fb367e3ff40603a9e43f3e3ee8025766eb339e | |
parent | 2f3cbef06e4fe177e7bf5b4e66c1996ade4c1c33 (diff) | |
download | ffmpeg-c5be140c9ada97e754cf95ffd26ac6cd5192f770.tar.gz |
Make url_split() strip url options (?opt=var) from the returned hostname or
location. This fixes a regression introduced by the rewrite of
url_split() in r10605.
Patch by Ronald S. Bultje: rsbultje gmail com
Original thread: [FFmpeg-devel] [PATCH] Make RTP work with IPv6 enabled
Date: 10/12/2007 08:19 PM
Originally committed as revision 10775 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/utils.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index c85b119b9e..cb03c89c3f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2875,7 +2875,7 @@ void url_split(char *proto, int proto_size, char *path, int path_size, const char *url) { - const char *p, *ls, *at, *col, *brk; + const char *p, *ls, *at, *col, *brk, *q; if (port_ptr) *port_ptr = -1; if (proto_size > 0) proto[0] = 0; @@ -2896,9 +2896,12 @@ void url_split(char *proto, int proto_size, } /* separate path from hostname */ - if ((ls = strchr(p, '/'))) - av_strlcpy(path, ls, path_size); - else + if ((ls = strchr(p, '/'))) { + if ((q = strchr(ls, '?'))) + av_strlcpy(path, ls, FFMIN(path_size, q - ls + 1)); + else + av_strlcpy(path, ls, path_size); + } else if (!(ls = strchr(p, '?'))) ls = &p[strlen(p)]; // XXX /* the rest is hostname, use that to parse auth/port */ |