summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-02-11 23:44:45 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-02-11 23:44:45 +0000
commit78b168dbc30d9540b96254b77cfeaef3619b540c (patch)
treeaa9f04eab868fe9a50a2a0ed2bcff4813e83fd15
parent874ae803ca9eae62e33f963c626a63b0db09bbcf (diff)
ssl support
-rw-r--r--src/http.c3
-rw-r--r--src/transmission-remote-gtk.schemas13
-rw-r--r--src/trg-client.c5
-rw-r--r--src/trg-client.h1
-rw-r--r--src/trg-preferences-dialog.c6
-rw-r--r--src/trg-preferences.h1
6 files changed, 26 insertions, 3 deletions
diff --git a/src/http.c b/src/http.c
index b4595ea..e8609fd 100644
--- a/src/http.c
+++ b/src/http.c
@@ -76,7 +76,8 @@ static struct http_response *trg_http_perform_inner(trg_client * tc,
curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, &header_callback);
curl_easy_setopt(handle, CURLOPT_WRITEHEADER, (void *) tc);
curl_easy_setopt(handle, CURLOPT_POSTFIELDS, req);
- /*curl_easy_setopt(handle, CURLOPT_VERBOSE, 1); */
+ if (tc->ssl)
+ curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0);
if (tc->session_id != NULL) {
headers = curl_slist_append(headers, tc->session_id);
diff --git a/src/transmission-remote-gtk.schemas b/src/transmission-remote-gtk.schemas
index dbd08aa..a4df4e0 100644
--- a/src/transmission-remote-gtk.schemas
+++ b/src/transmission-remote-gtk.schemas
@@ -28,6 +28,19 @@
</schema>
<schema>
+ <key>/schemas/apps/transmission-remote-gtk/ssl</key>
+ <applyto>/apps/transmission-remote-gtk/ssl</applyto>
+ <owner>transmission-remote-gtk</owner>
+ <type>bool</type>
+ <default>0</default>
+
+ <locale name="C">
+ <short>SSL</short>
+ <long>SSL</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/transmission-remote-gtk/system-tray</key>
<applyto>/apps/transmission-remote-gtk/system-tray</applyto>
<owner>transmission-remote-gtk</owner>
diff --git a/src/trg-client.c b/src/trg-client.c
index 35915b4..b7ac4fd 100644
--- a/src/trg-client.c
+++ b/src/trg-client.c
@@ -61,7 +61,10 @@ int trg_client_populate_with_settings(trg_client * tc,
if (!host || strlen(host) < 1)
return TRG_NO_HOSTNAME_SET;
- tc->url = g_strdup_printf("http://%s:%d/transmission/rpc", host, port);
+ tc->ssl = gconf_client_get_bool(gconf, TRG_GCONF_KEY_SSL, &error);
+ check_for_error(error);
+
+ tc->url = g_strdup_printf("%s://%s:%d/transmission/rpc", tc->ssl ? "https" : "http", host, port);
g_free(host);
tc->username =
diff --git a/src/trg-client.h b/src/trg-client.h
index 082f4d3..4d98420 100644
--- a/src/trg-client.h
+++ b/src/trg-client.h
@@ -33,6 +33,7 @@ typedef struct {
gint failCount;
gint64 updateSerial;
JsonObject *session;
+ gboolean ssl;
char *url;
char *username;
char *password;
diff --git a/src/trg-preferences-dialog.c b/src/trg-preferences-dialog.c
index 70c3465..e94f5c8 100644
--- a/src/trg-preferences-dialog.c
+++ b/src/trg-preferences-dialog.c
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -238,6 +238,10 @@ static GtkWidget *trg_prefs_serverPage(GConfClient * gconf)
TRG_GCONF_KEY_AUTO_CONNECT);
hig_workarea_add_wide_control(t, &row, w);
+ w = new_check_button(gconf, "SSL",
+ TRG_GCONF_KEY_SSL);
+ hig_workarea_add_wide_control(t, &row, w);
+
hig_workarea_add_section_divider(t, &row);
hig_workarea_add_section_title(t, &row, "Authentication");
diff --git a/src/trg-preferences.h b/src/trg-preferences.h
index 7c01cf6..bb52bca 100644
--- a/src/trg-preferences.h
+++ b/src/trg-preferences.h
@@ -25,6 +25,7 @@
#define TRG_GCONF_KEY_USERNAME "/apps/transmission-remote-gtk/username"
#define TRG_GCONF_KEY_PASSWORD "/apps/transmission-remote-gtk/password"
#define TRG_GCONF_KEY_AUTO_CONNECT "/apps/transmission-remote-gtk/auto-connect"
+#define TRG_GCONF_KEY_SSL "/apps/transmission-remote-gtk/ssl"
#define TRG_GCONF_KEY_WINDOW_WIDTH "/apps/transmission-remote-gtk/window-width"
#define TRG_GCONF_KEY_WINDOW_HEIGHT "/apps/transmission-remote-gtk/window-height"
#define TRG_GCONF_KEY_SYSTEM_TRAY "/apps/transmission-remote-gtk/system-tray"