diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-16 00:28:16 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-16 00:28:16 +0100 |
commit | ec86b2232da72f7b0c1c0a217d94b6e15698c795 (patch) | |
tree | 008111e5ae7d47ba5547be974769bd0751ee9fd0 /protocols/twitter/twitter_http.c | |
parent | ca0981ad1e427644a33fc31fe78d63ea834f0fa0 (diff) | |
parent | 6e6b3d7c7300c5cf5cf7f1538154925fd2fe3953 (diff) |
Mainline merge. (Probably mostly irrelevant for this branch, oh well.)
Diffstat (limited to 'protocols/twitter/twitter_http.c')
-rw-r--r-- | protocols/twitter/twitter_http.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/protocols/twitter/twitter_http.c b/protocols/twitter/twitter_http.c index 3632140f..51f437df 100644 --- a/protocols/twitter/twitter_http.c +++ b/protocols/twitter/twitter_http.c @@ -28,15 +28,17 @@ * * ****************************************************************************/ -#include "twitter_http.h" #include "twitter.h" #include "bitlbee.h" #include "url.h" #include "misc.h" #include "base64.h" +#include "oauth.h" #include <ctype.h> #include <errno.h> +#include "twitter_http.h" + char *twitter_url_append(char *url, char *key, char* value); @@ -44,7 +46,7 @@ char *twitter_url_append(char *url, char *key, char* value); * Do a request. * This is actually pretty generic function... Perhaps it should move to the lib/http_client.c */ -void *twitter_http(char *url_string, http_input_function func, gpointer data, int is_post, char* user, char* pass, char** arguments, int arguments_len) +void *twitter_http(char *url_string, http_input_function func, gpointer data, int is_post, char* user, char* pass, struct oauth_info* oi, char** arguments, int arguments_len) { url_t *url = g_new0( url_t, 1 ); char *tmp; @@ -109,7 +111,19 @@ void *twitter_http(char *url_string, http_input_function func, gpointer data, in is_post ? "POST" : "GET", url->file, url->host ); // If a pass and user are given we append them to the request. - if (userpass_base64) + if (oi) + { + char *full_header; + + full_header = oauth_http_header(oi, is_post ? "POST" : "GET", + url_string, url_arguments); + + tmp = g_strdup_printf("%sAuthorization: %s\r\n", request, full_header); + g_free(request); + g_free(full_header); + request = tmp; + } + else if (userpass_base64) { tmp = g_strdup_printf("%sAuthorization: Basic %s\r\n", request, userpass_base64); g_free(request); |