Package: xmms-scrobbler
Version: 0.3.6-1
Severity: wishlist
Tags: patch
hi,
since xmms-scrobbler uses libcurl, it is quite simple to make it use an
http proxy (configurable or by reading $HTTP_PROXY). However, attached
is a _dirty hack_, which reads $HTTP_PROXY and uses it. For me it worked
quite well:
[scrobbler.c] sc_submitentry: using Proxy
[scrobbler.c] sc_submitentry: a[0]=Benton%5FFalls t[0]=No%20Hero
l[0]=314 i[0]=2005%2D03%2D07%2016%3A33%3A17 m[0]= b[0]=Fighting%5FStarlight
Opening /home/abi/.xmms/scrobblerqueue.txt
[scrobbler.c] sc_parse_sb_res: got new interval: 1
[scrobbler.c] sc_parse_sb_res: submission ok: OK
INTERVAL 1
bye,
- michael
--- xmms-scrobbler-0.3.6/scrobbler.c 2004-12-10 14:54:49.000000000 +0100
+++ xmms-scrobbler-0.3.6.proxy/scrobbler.c 2005-03-07 17:34:49.000000000
+0100
@@ -42,6 +42,8 @@
static void dump_queue();
+char *http_proxy = NULL;
+
/* Error functions */
static void sc_throw_error(char *errortxt)
@@ -221,6 +223,12 @@
SCROBBLER_HS_URL, SCROBBLER_VERSION,
SCROBBLER_CLI_ID, VERSION, sc_username);
curl = curl_easy_init();
+
+ if(http_proxy) {
+ debug("using Proxy", DEBUG);
+ url_easy_setopt(curl, CURLOPT_PROXY, http_proxy);
+ }
+
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl, CURLOPT_URL, buf);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
@@ -375,7 +383,13 @@
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
sc_store_res);
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
- /*cfa(&post, &last, "debug", "failed");*/
+
+ if(http_proxy) {
+ pdebug("using Proxy", DEBUG);
+ curl_easy_setopt(curl, CURLOPT_PROXY, http_proxy);
+ }
+
+ /*cfa(&post, &last, "debug", "failed");*/
/*pdebug(fmt_vastr("Username: %s", sc_username), DEBUG);*/
submission = g_string_new("u=");
@@ -615,6 +629,8 @@
void sc_init(char *uname, char *pwd)
{
+ http_proxy = getenv("http_proxy");
+
sc_hs_status = sc_hs_timeout = sc_errors = sc_submit_timeout =
sc_srv_res_size = sc_giveup = sc_major_error_present =
sc_bad_users = 0;