diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2008-07-31 02:18:01 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2008-07-31 02:18:01 +0000 |
commit | fe1d024351a0c061882c2b8df1eba7f37a925830 (patch) | |
tree | fa0727d93c3d1eb6d5e95438a850fb6e31f987af | |
parent | 0de08d418feccc0d0f16a215c4ac3fb05e356198 (diff) |
Fixed a couple of problems in the IPv6 scope code. First, a host name in
an URL in a Location: header didn't have the scope ID removed, so an
invalid host name was used. Second, when the scope ID was removed, it
also removed any port number that may have existed in the URL.
-rw-r--r-- | lib/url.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -3089,16 +3089,19 @@ static CURLcode ParseURLAndFillConnection(struct SessionHandle *data, path[0] = '/'; } - if (conn->host.name[0] == '[' && !data->state.this_is_a_follow) { + if (conn->host.name[0] == '[') { /* This looks like an IPv6 address literal. See if there is an address scope. */ char *percent = strstr (conn->host.name, "%25"); if (percent) { char *endp; - conn->scope = strtoul (percent + 3, &endp, 10); + unsigned int scope = strtoul (percent + 3, &endp, 10); if (*endp == ']') { /* The address scope was well formed. Knock it out of the hostname. */ - strcpy (percent, "]"); + memmove(percent, endp, strlen(endp)+1); + if (!data->state.this_is_a_follow) + /* Don't honour a scope given in a Location: header */ + conn->scope = scope; } } } |