[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 01/63: parse_proxy: use the IPv6 zone id if given
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 01/63: parse_proxy: use the IPv6 zone id if given |
Date: |
Fri, 07 Jun 2019 18:36:23 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 12e564ca200d4b313d7404f6de00a042e78ea819
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue May 21 15:02:41 2019 +0200
parse_proxy: use the IPv6 zone id if given
If the proxy string is given as an IPv6 numerical address with a zone
id, make sure to use that for the connect to the proxy.
Reported-by: Edmond Yu
Fixes #3482
Closes #3918
---
lib/url.c | 61 ++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/lib/url.c b/lib/url.c
index c441ae716..16d910b71 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1884,6 +1884,40 @@ CURLcode Curl_uc_to_curlcode(CURLUcode uc)
}
/*
+ * If the URL was set with an IPv6 numerical address with a zone id part, set
+ * the scope_id based on that!
+ */
+
+static void zonefrom_url(CURLU *uh, struct connectdata *conn)
+{
+ char *zoneid;
+ CURLUcode uc;
+
+ uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0);
+
+ if(!uc && zoneid) {
+ char *endp;
+ unsigned long scope = strtoul(zoneid, &endp, 10);
+ if(!*endp && (scope < UINT_MAX))
+ /* A plain number, use it direcly as a scope id. */
+ conn->scope_id = (unsigned int)scope;
+#ifdef HAVE_IF_NAMETOINDEX
+ else {
+ /* Zone identifier is not numeric */
+ unsigned int scopeidx = 0;
+ scopeidx = if_nametoindex(zoneid);
+ if(!scopeidx)
+ infof(conn->data, "Invalid zoneid: %s; %s\n", zoneid,
+ strerror(errno));
+ else
+ conn->scope_id = scopeidx;
+ }
+#endif /* HAVE_IF_NAMETOINDEX */
+ free(zoneid);
+ }
+}
+
+/*
* Parse URL and fill in the relevant members of the connection struct.
*/
static CURLcode parseurlandfillconn(struct Curl_easy *data,
@@ -2004,38 +2038,14 @@ static CURLcode parseurlandfillconn(struct Curl_easy
*data,
if(hostname[0] == '[') {
/* This looks like an IPv6 address literal. See if there is an address
scope. */
- char *zoneid;
size_t hlen;
- uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0);
conn->bits.ipv6_ip = TRUE;
-
/* cut off the brackets! */
hostname++;
hlen = strlen(hostname);
hostname[hlen - 1] = 0;
- if(!uc && zoneid) {
- char *endp;
- unsigned long scope;
- scope = strtoul(zoneid, &endp, 10);
- if(!*endp && (scope < UINT_MAX)) {
- /* A plain number, use it direcly as a scope id. */
- conn->scope_id = (unsigned int)scope;
- }
-#ifdef HAVE_IF_NAMETOINDEX
- else {
- /* Zone identifier is not numeric */
- unsigned int scopeidx = 0;
- scopeidx = if_nametoindex(zoneid);
- if(!scopeidx)
- infof(data, "Invalid zoneid id: %s; %s\n", zoneid,
- strerror(errno));
- else
- conn->scope_id = scopeidx;
- }
-#endif /* HAVE_IF_NAMETOINDEX */
- free(zoneid);
- }
+ zonefrom_url(uh, conn);
}
/* make sure the connect struct gets its own copy of the host name */
@@ -2422,6 +2432,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
size_t len = strlen(host);
host[len-1] = 0; /* clear the trailing bracket */
host++;
+ zonefrom_url(uhp, conn);
}
proxyinfo->host.name = host;
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] branch master updated (7959939f1 -> 5d5e1c738), gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 03/63: PolarSSL: deprecate support step 1. Removed from configure., gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 01/63: parse_proxy: use the IPv6 zone id if given,
gnunet <=
- [GNUnet-SVN] [gnurl] 04/63: http2-download: fix format specifier, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 05/63: examples: reduce variable scopes, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 11/63: sasl: Implement SASL authorisation identity via CURLOPT_SASL_AUTHZID, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 10/63: tests: add support to test against OpenSSH for Windows, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 08/63: examples: fix "clarify calculation precedence" warnings, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 02/63: configure/cmake: check for if_nametoindex(), gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 13/63: examples: Added SASL PLAIN authorisation identity (authzid) examples, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 09/63: bump: start on the next release, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 15/63: url: fix bad #ifdef, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 14/63: Revert "progress: CURL_DISABLE_PROGRESS_METER", gnunet, 2019/06/07