changeset 2621:2aea27e618ba libavformat

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
author benoit
date Thu, 18 Oct 2007 09:50:53 +0000
parents 792383dd085e
children c63b1bd7be16
files utils.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Wed Oct 17 09:37:46 2007 +0000
+++ b/utils.c	Thu Oct 18 09:50:53 2007 +0000
@@ -2875,7 +2875,7 @@
                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 @@
     }
 
     /* 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 */