Commit ecd8c775 authored by andoma's avatar andoma

Add IPv6 support to url_split()

                                                                                
patch by: Ronald S. Bultje rsbultje a gmail d com                               
thread: "[PATCH] url_split() ipv6 support" at 2007/Sep/23 18:43                 



git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10615 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3831a42e
......@@ -2878,7 +2878,7 @@ void url_split(char *proto, int proto_size,
char *path, int path_size,
const char *url)
{
const char *p, *ls, *at, *col;
const char *p, *ls, *at, *col, *brk;
if (port_ptr) *port_ptr = -1;
if (proto_size > 0) proto[0] = 0;
......@@ -2913,13 +2913,19 @@ void url_split(char *proto, int proto_size,
p = at + 1; /* skip '@' */
}
/* port */
if ((col = strchr(p, ':')) && col < ls) {
ls = col;
if (port_ptr) *port_ptr = atoi(col + 1); /* skip ':' */
}
av_strlcpy(hostname, p, FFMIN(1 + ls - p, hostname_size));
if (*p == '[' && (brk = strchr(p, ']')) && brk < ls) {
/* [host]:port */
av_strlcpy(hostname, p + 1,
FFMIN(hostname_size, brk - p));
if (brk[1] == ':' && port_ptr)
*port_ptr = atoi(brk + 2);
} else if ((col = strchr(p, ':')) && col < ls) {
av_strlcpy(hostname, p,
FFMIN(col + 1 - p, hostname_size));
if (port_ptr) *port_ptr = atoi(col + 1);
} else
av_strlcpy(hostname, p,
FFMIN(ls + 1 - p, hostname_size));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment