urlapi: fix support for address scope in IPv6 numerical addresses

Closes #3024
This commit is contained in:
Daniel Stenberg 2018-09-21 08:17:39 +02:00
parent 9bdadbbdee
commit 2097cd5152
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 9 additions and 6 deletions

View file

@ -53,10 +53,6 @@ struct Curl_URL {
#define DEFAULT_SCHEME "https"
/* scheme is not URL encoded, the longest libcurl supported ones are 6
letters */
#define MAX_SCHEME_LEN 8
static void free_urlhandle(struct Curl_URL *u)
{
free(u->scheme);
@ -480,7 +476,7 @@ static CURLUcode parse_port(struct Curl_URL *u, char *hostname)
char endbracket;
int len;
if((1 == sscanf(hostname, "[%*45[0123456789abcdefABCDEF:.]%c%n",
if((1 == sscanf(hostname, "[%*45[0123456789abcdefABCDEF:.%%]%c%n",
&endbracket, &len)) &&
(']' == endbracket)) {
/* this is a RFC2732-style specified IP-address */
@ -561,7 +557,7 @@ static CURLUcode hostname_check(char *hostname, unsigned int flags)
if(hostname[0] == '[') {
hostname++;
l = "0123456789abcdefABCDEF::.";
l = "0123456789abcdefABCDEF::.%";
hlen -= 2;
}