changeset 707:88d78a61a9fb trunk

[svn] - proxy support. somebody test this.
author nenolod
date Sat, 24 Feb 2007 08:09:24 -0800
parents 6bc134eec1f3
children 9684a1b4e494
files ChangeLog src/curl/curl.c
diffstat 2 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 24 07:49:06 2007 -0800
+++ b/ChangeLog	Sat Feb 24 08:09:24 2007 -0800
@@ -1,3 +1,13 @@
+2007-02-24 15:49:06 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1498]
+  - make use of the new id3_file_vfsopen() function.
+  Patch by Christian Birchinger (joker).
+  
+  trunk/src/madplug/input.c      |    5 ++++-
+  trunk/src/madplug/replaygain.c |   25 +++++++++++++++++--------
+  2 files changed, 21 insertions(+), 9 deletions(-)
+
+
 2007-02-24 13:58:15 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [1496]
   Steal parser from paranormal and make sure all datestamps are the same so yacc does not run.
--- a/src/curl/curl.c	Sat Feb 24 07:49:06 2007 -0800
+++ b/src/curl/curl.c	Sat Feb 24 08:09:24 2007 -0800
@@ -22,6 +22,7 @@
 
 #include <audacious/vfs.h>
 #include <audacious/plugin.h>
+#include <audacious/configdb.h>
 
 #include <curl/curl.h>
 
@@ -547,6 +548,55 @@
 
   curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1);
 
+
+  {
+    gboolean tmp = FALSE;
+    ConfigDb *db;
+
+    db = bmp_cfg_db_open();
+
+    bmp_cfg_db_get_bool(db, NULL, "proxy_use", &tmp);
+    if (tmp == TRUE)
+    {
+      gchar *proxy_host = NULL;
+      gint proxy_port = 0;
+
+      bmp_cfg_db_get_string(db, NULL, "proxy_host", &proxy_host);
+      bmp_cfg_db_get_int(db, NULL, "proxy_port", &proxy_port);
+
+      curl_easy_setopt(handle->curl, CURLOPT_PROXY, proxy_host);
+      curl_easy_setopt(handle->curl, CURLOPT_PROXYPORT, proxy_port);
+
+      tmp = FALSE;
+
+      bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &tmp);
+      if (tmp == TRUE)
+      {
+        gchar *userbuf, *proxy_user = NULL, *proxy_pass = NULL;
+
+        bmp_cfg_db_get_string(db, NULL, "proxy_user", &proxy_user);
+        bmp_cfg_db_get_string(db, NULL, "proxy_pass", &proxy_pass);
+
+        userbuf = g_strdup_printf("%s:%s",
+          proxy_user != NULL ? proxy_user : "", 
+          proxy_pass != NULL ? proxy_pass : "");
+
+        if (proxy_user != NULL)
+          g_free(proxy_user);
+
+        if (proxy_pass != NULL)
+          g_free(proxy_pass);
+
+        curl_easy_setopt(handle->curl, CURLOPT_PROXYUSERPWD, userbuf);
+
+        g_free(userbuf);
+      }
+
+      if (proxy_host != NULL)
+        g_free(proxy_host);
+    }
+  }
+
   {
     struct curl_slist *hdr = NULL;
     hdr = curl_slist_append(hdr, "icy-metadata:1");