/cpw/tomkiewicz/gg11: 63439e75c0b1: Merge from trunk
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Sun Oct 21 15:27:15 EDT 2012
Changeset: 63439e75c0b121984748edf69e98868836d88f3f
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2012-10-21 21:27 +0200
Branch: default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/63439e75c0b1
Description:
Merge from trunk
diffstat:
configure.ac | 7 +-
finch/plugins/gnttinyurl.c | 1 +
libpurple/Makefile.am | 3 +
libpurple/connection.c | 2 +
libpurple/core.c | 3 +
libpurple/http.c | 2153 +++++++++++++++++++++++++++
libpurple/http.h | 562 +++++++
libpurple/obsolete.c | 773 +++++++++
libpurple/obsolete.h | 110 +
libpurple/plugins/perl/common/Util.xs | 51 -
libpurple/plugins/perl/common/module.h | 1 -
libpurple/protocols/gg/avatar.c | 1 +
libpurple/protocols/gg/ggdrive.c | 6 +
libpurple/protocols/gg/oauth/oauth-purple.c | 1 +
libpurple/protocols/gg/pubdir-prpl.c | 1 +
libpurple/protocols/jabber/google/relay.c | 1 +
libpurple/protocols/jabber/jabber.c | 1 +
libpurple/protocols/jabber/useravatar.c | 1 +
libpurple/protocols/msn/msn.c | 1 +
libpurple/protocols/msn/session.c | 1 +
libpurple/protocols/msn/slp.c | 1 +
libpurple/protocols/mxit/formcmds.c | 1 +
libpurple/protocols/mxit/login.c | 1 +
libpurple/protocols/mxit/markup.c | 1 +
libpurple/protocols/mxit/protocol.c | 1 +
libpurple/protocols/myspace/user.h | 2 +
libpurple/protocols/oscar/oscar.h | 1 +
libpurple/protocols/yahoo/libymsg.c | 1 +
libpurple/protocols/yahoo/yahoo_aliases.c | 1 +
libpurple/protocols/yahoo/yahoo_picture.c | 1 +
libpurple/protocols/yahoo/yahoo_profile.c | 1 +
libpurple/upnp.c | 1 +
libpurple/util.c | 681 --------
libpurple/util.h | 70 -
pidgin/gtkprefs.c | 1 +
pidgin/gtksmiley.c | 1 +
pidgin/gtkstatusbox.c | 1 +
pidgin/plugins/relnot.c | 47 +-
38 files changed, 3647 insertions(+), 847 deletions(-)
diffs (truncated from 4970 to 300 lines):
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -821,11 +821,8 @@ dnl ####################################
PKG_CHECK_MODULES([JSON], [json-glib-1.0], [enable_json="yes"], [enable_json="no"])
-dnl #######################################################################
-dnl # Check for libcurl (required)
-dnl #######################################################################
-
-PKG_CHECK_MODULES([LIBCURL], [libcurl])
+AC_SUBST(JSON_CFLAGS)
+AC_SUBST(JSON_LIBS)
dnl #######################################################################
dnl # Check for zlib (required)
diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c
--- a/finch/plugins/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl.c
@@ -21,6 +21,7 @@
#include "internal.h"
#include <glib.h>
+#include "obsolete.h"
#define PLUGIN_STATIC_NAME TinyURL
#define PREFS_BASE "/plugins/gnt/tinyurl"
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -50,6 +50,7 @@ purple_coresources = \
desktopitem.c \
eventloop.c \
ft.c \
+ http.c \
idle.c \
imgstore.c \
log.c \
@@ -65,6 +66,7 @@ purple_coresources = \
network.c \
ntlm.c \
notify.c \
+ obsolete.c \
plugin.c \
pluginpref.c \
pounce.c \
@@ -283,6 +285,7 @@ libpurple_la_SOURCES = \
noinst_HEADERS= \
internal.h \
+ obsolete.h \
media/backend-fs2.h \
valgrind.h
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -31,6 +31,7 @@
#include "connection.h"
#include "dbus-maybe.h"
#include "debug.h"
+#include "http.h"
#include "log.h"
#include "notify.h"
#include "prefs.h"
@@ -251,6 +252,7 @@ void
update_keepalive(gc, FALSE);
+ purple_http_conn_cancel_all(gc);
purple_proxy_connect_cancel_with_handle(gc);
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -33,6 +33,7 @@
#include "debug.h"
#include "dnsquery.h"
#include "ft.h"
+#include "http.h"
#include "idle.h"
#include "imgstore.h"
#include "network.h"
@@ -174,6 +175,7 @@ purple_core_init(const char *ui)
purple_stun_init();
purple_xfers_init();
purple_idle_init();
+ purple_http_init();
purple_smileys_init();
/*
* Call this early on to try to auto-detect our IP address and
@@ -222,6 +224,7 @@ purple_core_quit(void)
/* Save .xml files, remove signals, etc. */
purple_smileys_uninit();
+ purple_http_uninit();
purple_idle_uninit();
purple_pounces_uninit();
purple_blist_uninit();
diff --git a/libpurple/http.c b/libpurple/http.c
new file mode 100644
--- /dev/null
+++ b/libpurple/http.c
@@ -0,0 +1,2153 @@
+/**
+ * @file http.c HTTP API
+ * @ingroup core
+ */
+
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#include "http.h"
+
+#include "internal.h"
+
+#include "debug.h"
+#include "ntlm.h"
+
+#define PURPLE_HTTP_URL_CREDENTIALS_CHARS "a-z0-9.,~_/*!&%?=+\\^-"
+#define PURPLE_HTTP_MAX_RECV_BUFFER_LEN 10240
+
+#define PURPLE_HTTP_REQUEST_DEFAULT_MAX_REDIRECTS 20
+#define PURPLE_HTTP_REQUEST_DEFAULT_TIMEOUT 30
+
+typedef struct _PurpleHttpURL PurpleHttpURL;
+
+typedef struct _PurpleHttpSocket PurpleHttpSocket;
+
+typedef struct _PurpleHttpHeaders PurpleHttpHeaders;
+
+struct _PurpleHttpSocket
+{
+ gboolean is_ssl;
+ PurpleSslConnection *ssl_connection;
+ PurpleProxyConnectData *raw_connection;
+ int fd;
+ guint inpa;
+};
+
+struct _PurpleHttpRequest
+{
+ int ref_count;
+
+ gchar *url;
+ gchar *method;
+ PurpleHttpHeaders *headers;
+ PurpleHttpCookieJar *cookie_jar;
+
+ gchar *contents;
+ int contents_length;
+
+ int timeout;
+ int max_redirects;
+ gboolean http11;
+ int max_length;
+};
+
+struct _PurpleHttpConnection
+{
+ PurpleConnection *gc;
+ PurpleHttpCallback callback;
+ gpointer user_data;
+
+ PurpleHttpURL *url;
+ PurpleHttpRequest *request;
+ PurpleHttpResponse *response;
+
+ PurpleHttpSocket socket;
+ GString *request_header;
+ int request_header_written, request_contents_written;
+ gboolean main_header_got, headers_got;
+ GString *response_buffer;
+
+ int redirects_count;
+ int data_length_got;
+
+ int length_expected, length_got;
+
+ gboolean is_chunked, in_chunk, chunks_done;
+ int chunk_length, chunk_got;
+
+ GList *link_global, *link_gc;
+
+ guint timeout_handle;
+};
+
+struct _PurpleHttpResponse
+{
+ int code;
+ gchar *error;
+
+ GString *contents;
+ PurpleHttpHeaders *headers;
+};
+
+struct _PurpleHttpURL
+{
+ gchar *protocol;
+ gchar *user;
+ gchar *password;
+ gchar *host;
+ int port;
+ gchar *path;
+ gchar *fragment;
+};
+
+struct _PurpleHttpHeaders
+{
+ GList *list;
+ GHashTable *by_name;
+};
+
+typedef struct
+{
+ time_t expires;
+ gchar *value;
+} PurpleHttpCookie;
+
+struct _PurpleHttpCookieJar
+{
+ int ref_count;
+
+ GHashTable *tab;
+};
+
+static time_t purple_http_rfc1123_to_time(const gchar *str);
+
+static PurpleHttpConnection * purple_http_connection_new(
+ PurpleHttpRequest *request, PurpleConnection *gc);
+static void purple_http_connection_terminate(PurpleHttpConnection *hc);
+
+static PurpleHttpResponse * purple_http_response_new(void);
+static void purple_http_response_free(PurpleHttpResponse *response);
+
+static void purple_http_cookie_jar_parse(PurpleHttpCookieJar *cookie_jar,
+ GList *values);
+static gchar * purple_http_cookie_jar_gen(PurpleHttpCookieJar *cookie_jar);
+gchar * purple_http_cookie_jar_dump(PurpleHttpCookieJar *cjar);
+
+static PurpleHttpURL * purple_http_url_parse(const char *url);
+static void purple_http_url_free(PurpleHttpURL *parsed_url);
+static void purple_http_url_relative(PurpleHttpURL *base_url,
+ PurpleHttpURL *relative_url);
+static gchar * purple_http_url_print(PurpleHttpURL *parsed_url);
+
+static GRegex *purple_http_re_url, *purple_http_re_url_host,
+ *purple_http_re_rfc1123;
+
+/**
+ * Values: pointers to running PurpleHttpConnection.
+ */
+static GList *purple_http_hc_list;
+
+/**
+ * Keys: pointers to PurpleConnection.
+ * Values: GList of pointers to running PurpleHttpConnection.
+ */
+static GHashTable *purple_http_hc_by_gc;
+
+/**
+ * Keys: pointers to PurpleHttpConnection.
+ * Values: pointers to links in purple_http_hc_list.
+ */
+static GHashTable *purple_http_hc_by_ptr;
+
+/*** Helper functions *********************************************************/
+
+static time_t purple_http_rfc1123_to_time(const gchar *str)
+{
+ static const gchar *months[13] = {"jan", "feb", "mar", "apr", "may", "jun",
+ "jul", "aug", "sep", "oct", "nov", "dec", NULL};
+ GMatchInfo *match_info;
+ gchar *d_date, *d_month, *d_year, *d_time;
+ int month;
+ gchar *iso_date;
+ time_t t;
+
+ g_return_val_if_fail(str != NULL, 0);
+
More information about the Commits
mailing list