summaryrefslogtreecommitdiff
path: root/src/trg-client.c
diff options
context:
space:
mode:
authorGravatar Alan F <ajf@eth0.org.uk>2014-02-19 08:54:10 +0000
committerGravatar Alan F <ajf@eth0.org.uk>2014-02-19 08:54:10 +0000
commit1d6f77d4c4fafd0a9cafddd2797249557e601dba (patch)
tree33dee51882a0475aff63ec6c6d9095c92c9ac5d4 /src/trg-client.c
parentadf06453574270bf467b5f37e632c04c153ee90a (diff)
refactor the torrent upload code (it's called from a few places so is probably worth it), and make it easier to use a HTTP response as the input.
Diffstat (limited to 'src/trg-client.c')
-rw-r--r--src/trg-client.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/trg-client.c b/src/trg-client.c
index 6f33b36..8ab2afd 100644
--- a/src/trg-client.c
+++ b/src/trg-client.c
@@ -442,11 +442,15 @@ void trg_client_configunlock(TrgClient * tc)
void trg_response_free(trg_response * response)
{
- if (response->obj)
- json_object_unref(response->obj);
- if (response->raw)
- g_free(response->raw);
- g_free(response);
+ if (response) {
+ if (response->obj)
+ json_object_unref(response->obj);
+
+ if (response->raw)
+ g_free(response->raw);
+
+ g_free(response);
+ }
}
static size_t
@@ -559,10 +563,6 @@ static CURL* get_curl(TrgClient *tc, guint http_class)
priv->http_class = http_class;
}
- if (http_class == HTTP_CLASS_TRANSMISSION) {
- curl_easy_setopt(curl, CURLOPT_URL, trg_client_get_url(tc));
- }
-
curl_easy_setopt(curl, CURLOPT_TIMEOUT,
(long) trg_prefs_get_int(prefs, TRG_PREFS_KEY_TIMEOUT,
TRG_PREFS_CONNECTION));