diff options
Diffstat (limited to '')
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/input_curl.c | 30 |
2 files changed, 31 insertions, 0 deletions
@@ -14,6 +14,7 @@ ver 0.15 - (200?/??/??) * added Icy-Metadata support * fix cross-fading bug: it used to play some chunks of the new song twice * --create-db starts the MPD daemon instead of exiting +* input_curl: honour http_proxy_* config directives ver 0.14 (2008/12/25) * audio outputs: diff --git a/src/input_curl.c b/src/input_curl.c index d9655fc62..cb2127a4a 100644 --- a/src/input_curl.c +++ b/src/input_curl.c @@ -18,6 +18,7 @@ #include "input_curl.h" #include "input_stream.h" +#include "conf.h" #include "config.h" #include "tag.h" #include "icy_metadata.h" @@ -619,6 +620,10 @@ input_curl_easy_init(struct input_stream *is) struct input_curl *c = is->data; CURLcode code; CURLMcode mcode; + ConfigParam *proxy_host; + ConfigParam *proxy_port; + ConfigParam *proxy_user; + ConfigParam *proxy_pass; c->eof = false; @@ -646,6 +651,31 @@ input_curl_easy_init(struct input_stream *is) curl_easy_setopt(c->easy, CURLOPT_FAILONERROR, true); curl_easy_setopt(c->easy, CURLOPT_ERRORBUFFER, c->error); + proxy_host = getConfigParam(CONF_HTTP_PROXY_HOST); + proxy_port = getConfigParam(CONF_HTTP_PROXY_PORT); + proxy_user = getConfigParam(CONF_HTTP_PROXY_USER); + proxy_pass = getConfigParam(CONF_HTTP_PROXY_PASSWORD); + + if (proxy_host != NULL) { + char *proxy_host_str; + + if (proxy_port == NULL) { + proxy_host_str = g_strdup(proxy_host->value); + } else { + proxy_host_str = + g_strconcat(proxy_host->value, ":", proxy_port->value, NULL); + } + curl_easy_setopt(c->easy, CURLOPT_PROXY, proxy_host_str); + g_free(proxy_host_str); + } + + if ((proxy_user != NULL) && (proxy_pass != NULL)) { + char *proxy_auth_str = + g_strconcat(proxy_user->value, ":", proxy_pass->value, NULL); + curl_easy_setopt(c->easy, CURLOPT_PROXYUSERPWD, proxy_auth_str); + g_free(proxy_auth_str); + } + code = curl_easy_setopt(c->easy, CURLOPT_URL, c->url); if (code != CURLE_OK) return false; |