mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-05 12:31:50 +01:00
* http.c (do_parse_uri): Properly handle IPv6 literal addresses as per
RFC-2732. Adapted from patch by Phil Pennock.
This commit is contained in:
parent
81723b397a
commit
f801e0f9a8
@ -1,5 +1,8 @@
|
|||||||
2009-03-13 David Shaw <dshaw@jabberwocky.com>
|
2009-03-13 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* http.c (do_parse_uri): Properly handle IPv6 literal addresses as
|
||||||
|
per RFC-2732. Adapted from patch by Phil Pennock.
|
||||||
|
|
||||||
* Makefile.am, http.c (start_server): Minor tweaks to get
|
* Makefile.am, http.c (start_server): Minor tweaks to get
|
||||||
http-test compiling again.
|
http-test compiling again.
|
||||||
|
|
||||||
|
25
util/http.c
25
util/http.c
@ -343,16 +343,27 @@ do_parse_uri( PARSED_URI uri, int only_local_part )
|
|||||||
}
|
}
|
||||||
|
|
||||||
strlwr( p );
|
strlwr( p );
|
||||||
uri->host = p;
|
|
||||||
if( (p3=strchr( p, ':' )) ) {
|
|
||||||
*p3++ = 0;
|
|
||||||
uri->port = atoi( p3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
uri->host = p;
|
/* Handle a host of [IP] so that [IP:V6]:port works */
|
||||||
|
if( *p == '[' && (p3=strchr( p, ']' )) )
|
||||||
|
{
|
||||||
|
*p3++ = '\0';
|
||||||
|
/* worst case, uri->host should have length 0, points to \0 */
|
||||||
|
uri->host = p + 1;
|
||||||
|
p = p3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
uri->host = p;
|
||||||
|
|
||||||
|
if( (p3=strchr( p, ':' )) )
|
||||||
|
{
|
||||||
|
*p3++ = '\0';
|
||||||
|
uri->port = atoi( p3 );
|
||||||
|
}
|
||||||
|
|
||||||
if( (n = remove_escapes( uri->host )) < 0 )
|
if( (n = remove_escapes( uri->host )) < 0 )
|
||||||
return G10ERR_BAD_URI;
|
return G10ERR_BAD_URI;
|
||||||
if( n != strlen( p ) )
|
if( n != strlen( uri->host ) )
|
||||||
return G10ERR_BAD_URI; /* hostname with a Nul in it */
|
return G10ERR_BAD_URI; /* hostname with a Nul in it */
|
||||||
p = p2 ? p2 : NULL;
|
p = p2 ? p2 : NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user