summaryrefslogtreecommitdiff
path: root/src/http.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-08 23:00:13 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-08 23:00:13 +0000
commit3757c78e835d01bddf89675e1c60a77020543338 (patch)
treec145fd0cff4718639bbc26d57c4f37859337c003 /src/http.c
parent10df84a14e6ce6d40ddd55a2d24442b6d9dc5dd4 (diff)
install license and use it in about dialog if possible
Diffstat (limited to 'src/http.c')
-rw-r--r--src/http.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/http.c b/src/http.c
index a2eba57..6e4e08b 100644
--- a/src/http.c
+++ b/src/http.c
@@ -30,6 +30,9 @@
#include "trg-client.h"
#include "http.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
static struct http_response *trg_http_perform_inner(trg_client * client,
gchar * req,
@@ -65,7 +68,7 @@ static struct http_response *trg_http_perform_inner(trg_client * tc,
handle = curl_easy_init();
- curl_easy_setopt(handle, CURLOPT_USERAGENT, "trg");
+ curl_easy_setopt(handle, CURLOPT_USERAGENT, PACKAGE_NAME);
curl_easy_setopt(handle, CURLOPT_PASSWORD, tc->password);
curl_easy_setopt(handle, CURLOPT_USERNAME, tc->username);
curl_easy_setopt(handle, CURLOPT_URL, tc->url);
@@ -86,7 +89,7 @@ static struct http_response *trg_http_perform_inner(trg_client * tc,
}
- if (tc->session_id != NULL) {
+ if (tc->session_id) {
headers = curl_slist_append(headers, tc->session_id);
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
}
@@ -137,10 +140,10 @@ static size_t header_callback(void *ptr, size_t size, size_t nmemb,
char *header = (char *) (ptr);
trg_client *client = (trg_client *) data;
- if (g_str_has_prefix(header, "X-Transmission-Session-Id: ") == TRUE) {
+ if (g_str_has_prefix(header, "X-Transmission-Session-Id: ")) {
char *nl;
- if (client->session_id != NULL)
+ if (client->session_id)
g_free(client->session_id);
client->session_id = g_strdup(header);