[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33054 - gnunet/src/hostlist
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33054 - gnunet/src/hostlist |
Date: |
Mon, 14 Apr 2014 11:23:07 +0200 |
Author: wachs
Date: 2014-04-14 11:23:07 +0200 (Mon, 14 Apr 2014)
New Revision: 33054
Modified:
gnunet/src/hostlist/hostlist-client.c
gnunet/src/hostlist/hostlist.conf
Log:
extended proxy support for hostlist
Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c 2014-04-14 08:52:41 UTC (rev
33053)
+++ gnunet/src/hostlist/hostlist-client.c 2014-04-14 09:23:07 UTC (rev
33054)
@@ -116,11 +116,26 @@
static struct GNUNET_TRANSPORT_Handle *transport;
/**
- * Proxy that we are using (can be NULL).
+ * Proxy hostname or ip we are using (can be NULL).
*/
static char *proxy;
/**
+ * Proxy username we are using (can be NULL).
+ */
+static char *proxy_username;
+
+/**
+ * Proxy password we are using (can be NULL).
+ */
+static char *proxy_password;
+
+/**
+ * Proxy type we are using (can be NULL).
+ */
+static curl_proxytype proxy_type;
+
+/**
* Number of bytes valid in 'download_buffer'.
*/
static size_t download_pos;
@@ -1435,6 +1450,7 @@
GNUNET_CORE_MessageCallback *msgh, int learn)
{
char *filename;
+ char *proxytype_str;
int result;
GNUNET_assert (NULL != st);
@@ -1451,10 +1467,73 @@
}
cfg = c;
stats = st;
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", "HTTP-PROXY",
- &proxy))
- proxy = NULL;
+
+ /* Read proxy configuration */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST", "PROXY", &proxy))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found proxy host: `%s'\n",
+ proxy);
+ /* proxy username */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST", "PROXY_USERNAME", &proxy_username))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found proxy username name: `%s'\n",
+ proxy_username);
+ }
+
+ /* proxy password */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST", "PROXY_PASSWORD", &proxy_password))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found proxy password name: `%s'\n",
+ proxy_password);
+ }
+
+ /* proxy type */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
+ "HOSTLIST", "PROXY_TYPE", &proxytype_str))
+ {
+ GNUNET_STRINGS_utf8_toupper (proxytype_str, proxytype_str);
+
+ if (0 == strcmp(proxytype_str, "HTTP"))
+ proxy_type = CURLPROXY_HTTP;
+ else if (0 == strcmp(proxytype_str, "HTTP_1_0"))
+ proxy_type = CURLPROXY_HTTP_1_0;
+ else if (0 == strcmp(proxytype_str, "SOCKS4"))
+ proxy_type = CURLPROXY_SOCKS4;
+ else if (0 == strcmp(proxytype_str, "SOCKS5"))
+ proxy_type = CURLPROXY_SOCKS5;
+ else if (0 == strcmp(proxytype_str, "SOCKS4A"))
+ proxy_type = CURLPROXY_SOCKS4A;
+ else if (0 == strcmp(proxytype_str, "SOCKS5_HOSTNAME "))
+ proxy_type = CURLPROXY_SOCKS5_HOSTNAME ;
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Invalid proxy type: `%s', disabling proxy! Check
configuration!\n"),
+ proxytype_str);
+ GNUNET_free (proxytype_str);
+
+ GNUNET_free (proxy);
+ proxy = NULL;
+ GNUNET_free_non_null (proxy_username);
+ proxy_username = NULL;
+ GNUNET_free_non_null (proxy_password);
+ proxy_password = NULL;
+
+ return GNUNET_SYSERR;
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Found proxy type: `%s'\n", proxy_type);
+ }
+ GNUNET_free_non_null (proxytype_str);
+ }
+
stat_learning = learn;
*ch = &handler_connect;
*dh = &handler_disconnect;
@@ -1559,6 +1638,11 @@
}
GNUNET_free_non_null (proxy);
proxy = NULL;
+ GNUNET_free_non_null (proxy_username);
+ proxy_username = NULL;
+ GNUNET_free_non_null (proxy_password);
+ proxy_password = NULL;
+
cfg = NULL;
}
Modified: gnunet/src/hostlist/hostlist.conf
===================================================================
--- gnunet/src/hostlist/hostlist.conf 2014-04-14 08:52:41 UTC (rev 33053)
+++ gnunet/src/hostlist/hostlist.conf 2014-04-14 09:23:07 UTC (rev 33054)
@@ -12,8 +12,18 @@
OPTIONS = -b
SERVERS = http://v10.gnunet.org/hostlist
# http://ioerror.gnunet.org:65535/
-# proxy for downloading hostlists
-HTTP-PROXY =
# bind hostlist http server to a specific IPv4 or IPv6
# BINDTOIP =
+# Hostname or IP of proxy server for downloading hostlists
+# PROXY =
+
+# User name for proxy server
+# PROXY_USERNAME =
+# User password for proxy server
+# PROXY_PASSWORD =
+
+# Type of proxy server,
+# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
+# Default: HTTP
+# PROXY_TYPE = HTTP
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33054 - gnunet/src/hostlist,
gnunet <=