[FFmpeg-devel] [PATCH] url_split() ipv6 support
Benoit Fouet
benoit.fouet
Thu Sep 27 09:03:00 CEST 2007
Ronald S. Bultje wrote:
> Hi,
>
> On 9/23/07, Ronald S. Bultje <rsbultje at gmail.com> wrote:
>
>> see $subj, this patch adds support for parsing hostnames such as:
>> proto://[ipv6host]:port/address
>> proto://ipv6host:port/address
>>
>
>
>Index: utils.c
>===================================================================
>--- utils.c (revision 9789)
>+++ utils.c (working copy)
>@@ -2817,7 +2817,8 @@
> hostname[0] = '\0';
> p = url;
> } else {
>- char *at,*slash; // PETR: position of '@' character and '/'
character
>+ char *at,*slash,*colon = NULL, *hostp; // PETR: position of
'@' character and '/' character
initialization doesn't seem to be needed
>+ int ncols = 0, have_brkt = 0, have_trpcol = 0, have_dblcol = 0;
>
> p++;
> if (*p == '/')
>@@ -2827,17 +2828,56 @@
> at = strchr(p,'@'); // PETR: get the position of '@'
> slash = strchr(p,'/'); // PETR: get position of '/' - end of
hostname
> if (at && slash && at > slash) at = NULL; // PETR: not
interested in '@' behind '/'
>+ hostp = at ? &at[1] : p;
>+ if (hostp && hostp[0] == '[' && (colon = strchr(hostp, ']')) &&
>+ (colon[1] == ':' || colon[1] == '/' || colon[1] == '\0') &&
>+ (!slash || colon < slash)) {
>+ /* support [host]:port */
>+ ncols++;
>+ have_brkt = 1;
>+ } else for (q = hostp; (!slash && *q) || q < slash; q++) {
>+ if (*q == ':') {
weird indentation
--
Ben
Purple Labs S.A.
www.purplelabs.com
More information about the ffmpeg-devel
mailing list