comparison utils.c @ 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 75b75b51ef2f
children 1864b0a09d52
comparison
equal deleted inserted replaced
2620:792383dd085e 2621:2aea27e618ba
2873 char *hostname, int hostname_size, 2873 char *hostname, int hostname_size,
2874 int *port_ptr, 2874 int *port_ptr,
2875 char *path, int path_size, 2875 char *path, int path_size,
2876 const char *url) 2876 const char *url)
2877 { 2877 {
2878 const char *p, *ls, *at, *col, *brk; 2878 const char *p, *ls, *at, *col, *brk, *q;
2879 2879
2880 if (port_ptr) *port_ptr = -1; 2880 if (port_ptr) *port_ptr = -1;
2881 if (proto_size > 0) proto[0] = 0; 2881 if (proto_size > 0) proto[0] = 0;
2882 if (authorization_size > 0) authorization[0] = 0; 2882 if (authorization_size > 0) authorization[0] = 0;
2883 if (hostname_size > 0) hostname[0] = 0; 2883 if (hostname_size > 0) hostname[0] = 0;
2894 av_strlcpy(path, url, path_size); 2894 av_strlcpy(path, url, path_size);
2895 return; 2895 return;
2896 } 2896 }
2897 2897
2898 /* separate path from hostname */ 2898 /* separate path from hostname */
2899 if ((ls = strchr(p, '/'))) 2899 if ((ls = strchr(p, '/'))) {
2900 av_strlcpy(path, ls, path_size); 2900 if ((q = strchr(ls, '?')))
2901 else 2901 av_strlcpy(path, ls, FFMIN(path_size, q - ls + 1));
2902 else
2903 av_strlcpy(path, ls, path_size);
2904 } else if (!(ls = strchr(p, '?')))
2902 ls = &p[strlen(p)]; // XXX 2905 ls = &p[strlen(p)]; // XXX
2903 2906
2904 /* the rest is hostname, use that to parse auth/port */ 2907 /* the rest is hostname, use that to parse auth/port */
2905 if (ls != p) { 2908 if (ls != p) {
2906 /* authorization (user[:pass]@hostname) */ 2909 /* authorization (user[:pass]@hostname) */