curl: moved proxy settings to "input" block
The old global settings "http_proxy_host", "http_proxy_port", "http_proxy_user" and "http_proxy_password" continue to work.
This commit is contained in:
parent
bd014483c2
commit
11bcd7f013
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@ ver 0.15 (200?/??/??)
|
||||||
- added support for the MMS protocol
|
- added support for the MMS protocol
|
||||||
- hide HTTP password in playlist
|
- hide HTTP password in playlist
|
||||||
- lastfm: new input plugin for last.fm radio (experimental and incomplete!)
|
- lastfm: new input plugin for last.fm radio (experimental and incomplete!)
|
||||||
|
- curl: moved proxy settings to "input" block
|
||||||
* tags:
|
* tags:
|
||||||
- support the "album artist" tag
|
- support the "album artist" tag
|
||||||
- support MusicBrainz tags
|
- support MusicBrainz tags
|
||||||
|
|
|
@ -210,16 +210,8 @@ The default is 10%, a little over 1 second of CD-quality audio with the default
|
||||||
buffer size.
|
buffer size.
|
||||||
.TP
|
.TP
|
||||||
.B http_proxy_host <hostname>
|
.B http_proxy_host <hostname>
|
||||||
Use to specify the proxy host used for HTTP connections.
|
This setting is deprecated. Use the "proxy" setting in the "curl"
|
||||||
.TP
|
input block. See MPD user manual for details.
|
||||||
.B http_proxy_port <port>
|
|
||||||
The port that the HTTP proxy host uses.
|
|
||||||
.TP
|
|
||||||
.B http_proxy_user <username>
|
|
||||||
If the HTTP proxy server requires authentication, this specifies the username.
|
|
||||||
.TP
|
|
||||||
.B http_proxy_password <password>
|
|
||||||
If the HTTP proxy server requires authentication, this specifies the password.
|
|
||||||
.TP
|
.TP
|
||||||
.B connection_timeout <seconds>
|
.B connection_timeout <seconds>
|
||||||
If a client does not send any new data in this time period, the connection is
|
If a client does not send any new data in this time period, the connection is
|
||||||
|
|
|
@ -149,6 +149,19 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# Input #######################################################################
|
||||||
|
#
|
||||||
|
|
||||||
|
input {
|
||||||
|
plugin "curl"
|
||||||
|
# proxy "proxy.isp.com:8080"
|
||||||
|
# proxy_user "user"
|
||||||
|
# proxy_password "password"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
# Audio Output ################################################################
|
# Audio Output ################################################################
|
||||||
#
|
#
|
||||||
# MPD supports various audio output types, as well as playing through multiple
|
# MPD supports various audio output types, as well as playing through multiple
|
||||||
|
@ -325,19 +338,6 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
# HTTP Streaming Proxy ########################################################
|
|
||||||
#
|
|
||||||
# This setting specifies the HTTP proxy to use for playing HTTP streams. These
|
|
||||||
# settings will be disabled by default.
|
|
||||||
#
|
|
||||||
#http_proxy_host "proxy.isp.com"
|
|
||||||
#http_proxy_port "8080"
|
|
||||||
#http_proxy_user "user"
|
|
||||||
#http_proxy_password "password"
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
# Resource Limitations ########################################################
|
# Resource Limitations ########################################################
|
||||||
#
|
#
|
||||||
# These settings are various limitations to prevent MPD from using too many
|
# These settings are various limitations to prevent MPD from using too many
|
||||||
|
|
30
doc/user.xml
30
doc/user.xml
|
@ -303,6 +303,36 @@ cd mpd-0.14.2</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Opens remote files or streams over HTTP.
|
Opens remote files or streams over HTTP.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<informaltable>
|
||||||
|
<tgroup cols="2">
|
||||||
|
<thead>
|
||||||
|
<row>
|
||||||
|
<entry>Setting</entry>
|
||||||
|
<entry>Description</entry>
|
||||||
|
</row>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>proxy</varname>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Sets the address of the HTTP proxy server.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
<varname>proxy_user</varname>,
|
||||||
|
<varname>proxy_password</varname>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Configures proxy authentication.
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
||||||
|
</tgroup>
|
||||||
|
</informaltable>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -98,8 +98,12 @@ struct input_curl {
|
||||||
/** libcurl should accept "ICY 200 OK" */
|
/** libcurl should accept "ICY 200 OK" */
|
||||||
static struct curl_slist *http_200_aliases;
|
static struct curl_slist *http_200_aliases;
|
||||||
|
|
||||||
|
/** HTTP proxy settings */
|
||||||
|
static const char *proxy, *proxy_user, *proxy_password;
|
||||||
|
static unsigned proxy_port;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
input_curl_init(G_GNUC_UNUSED const struct config_param *param)
|
input_curl_init(const struct config_param *param)
|
||||||
{
|
{
|
||||||
CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
|
CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
|
||||||
if (code != CURLE_OK) {
|
if (code != CURLE_OK) {
|
||||||
|
@ -110,6 +114,21 @@ input_curl_init(G_GNUC_UNUSED const struct config_param *param)
|
||||||
|
|
||||||
http_200_aliases = curl_slist_append(http_200_aliases, "ICY 200 OK");
|
http_200_aliases = curl_slist_append(http_200_aliases, "ICY 200 OK");
|
||||||
|
|
||||||
|
proxy = config_get_block_string(param, "proxy", NULL);
|
||||||
|
proxy_port = config_get_block_unsigned(param, "proxy_port", 0);
|
||||||
|
proxy_user = config_get_block_string(param, "proxy_user", NULL);
|
||||||
|
proxy_password = config_get_block_string(param, "proxy_password",
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (proxy == NULL) {
|
||||||
|
/* deprecated proxy configuration */
|
||||||
|
proxy = config_get_string(CONF_HTTP_PROXY_HOST, NULL);
|
||||||
|
proxy_port = config_get_positive(CONF_HTTP_PROXY_PORT, 0);
|
||||||
|
proxy_user = config_get_string(CONF_HTTP_PROXY_USER, NULL);
|
||||||
|
proxy_password = config_get_string(CONF_HTTP_PROXY_PASSWORD,
|
||||||
|
"");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,10 +665,6 @@ input_curl_easy_init(struct input_stream *is)
|
||||||
struct input_curl *c = is->data;
|
struct input_curl *c = is->data;
|
||||||
CURLcode code;
|
CURLcode code;
|
||||||
CURLMcode mcode;
|
CURLMcode mcode;
|
||||||
const char *proxy_host;
|
|
||||||
const char *proxy_port;
|
|
||||||
const char *proxy_user;
|
|
||||||
const char *proxy_pass;
|
|
||||||
|
|
||||||
c->eof = false;
|
c->eof = false;
|
||||||
|
|
||||||
|
@ -677,28 +692,15 @@ input_curl_easy_init(struct input_stream *is)
|
||||||
curl_easy_setopt(c->easy, CURLOPT_FAILONERROR, true);
|
curl_easy_setopt(c->easy, CURLOPT_FAILONERROR, true);
|
||||||
curl_easy_setopt(c->easy, CURLOPT_ERRORBUFFER, c->error);
|
curl_easy_setopt(c->easy, CURLOPT_ERRORBUFFER, c->error);
|
||||||
|
|
||||||
proxy_host = config_get_string(CONF_HTTP_PROXY_HOST, NULL);
|
if (proxy != NULL)
|
||||||
proxy_port = config_get_string(CONF_HTTP_PROXY_PORT, NULL);
|
curl_easy_setopt(c->easy, CURLOPT_PROXY, proxy);
|
||||||
|
|
||||||
if (proxy_host != NULL) {
|
if (proxy_port > 0)
|
||||||
char *proxy_host_str;
|
curl_easy_setopt(c->easy, CURLOPT_PROXYPORT, (long)proxy_port);
|
||||||
|
|
||||||
if (proxy_port == NULL) {
|
if (proxy_user != NULL && proxy_password != NULL) {
|
||||||
proxy_host_str = g_strdup(proxy_host);
|
|
||||||
} else {
|
|
||||||
proxy_host_str =
|
|
||||||
g_strconcat(proxy_host, ":", proxy_port, NULL);
|
|
||||||
}
|
|
||||||
curl_easy_setopt(c->easy, CURLOPT_PROXY, proxy_host_str);
|
|
||||||
g_free(proxy_host_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy_user = config_get_string(CONF_HTTP_PROXY_USER, NULL);
|
|
||||||
proxy_pass = config_get_string(CONF_HTTP_PROXY_PASSWORD, NULL);
|
|
||||||
|
|
||||||
if ((proxy_user != NULL) && (proxy_pass != NULL)) {
|
|
||||||
char *proxy_auth_str =
|
char *proxy_auth_str =
|
||||||
g_strconcat(proxy_user, ":", proxy_pass, NULL);
|
g_strconcat(proxy_user, ":", proxy_password, NULL);
|
||||||
curl_easy_setopt(c->easy, CURLOPT_PROXYUSERPWD, proxy_auth_str);
|
curl_easy_setopt(c->easy, CURLOPT_PROXYUSERPWD, proxy_auth_str);
|
||||||
g_free(proxy_auth_str);
|
g_free(proxy_auth_str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue