pidgin.2.4.3: b54e0252: applied changes from 43cf42d58f68c1f3f9a...
datallah at pidgin.im
datallah at pidgin.im
Wed Jun 18 23:52:22 EDT 2008
-----------------------------------------------------------------
Revision: b54e02523330c7ca6acfa50ef2a7969382befefb
Ancestor: a89fa133b928c3a65431e7d89b73b03ed5eff16d
Author: datallah at pidgin.im
Date: 2008-06-19T02:55:19
Branch: im.pidgin.pidgin.2.4.3
URL: http://d.pidgin.im/viewmtn/revision/info/b54e02523330c7ca6acfa50ef2a7969382befefb
Modified files:
libpurple/proxy.c
ChangeLog:
applied changes from 43cf42d58f68c1f3f9ae27b10c66dbc351612f30
through 0130292e82764988f2d833f4a5d3ff5523f2eb7f
-------------- next part --------------
============================================================
--- libpurple/proxy.c cc69174d8b54624c4501260d0fd2bd5a5f87379e
+++ libpurple/proxy.c 20d7678e2a21a7cac99ef00573ac5e68c0efbd81
@@ -837,33 +837,10 @@ static void
}
static void
-http_canwrite(gpointer data, gint source, PurpleInputCondition cond)
-{
+http_start_connect_tunneling(PurpleProxyConnectData *connect_data) {
GString *request;
- PurpleProxyConnectData *connect_data;
- int error = ETIMEDOUT;
int ret;
- connect_data = data;
-
- purple_debug_info("proxy", "Connected to %s:%d.\n",
- connect_data->host, connect_data->port);
-
- if (connect_data->inpa > 0)
- {
- purple_input_remove(connect_data->inpa);
- connect_data->inpa = 0;
- }
-
- ret = purple_input_get_error(connect_data->fd, &error);
- if ((ret != 0) || (error != 0))
- {
- if (ret != 0)
- error = errno;
- purple_proxy_connect_data_disconnect(connect_data, g_strerror(error));
- return;
- }
-
purple_debug_info("proxy", "Using CONNECT tunneling for %s:%d\n",
connect_data->host, connect_data->port);
@@ -912,10 +889,48 @@ http_canwrite(gpointer data, gint source
connect_data->inpa = purple_input_add(connect_data->fd,
PURPLE_INPUT_WRITE, proxy_do_write, connect_data);
- proxy_do_write(connect_data, connect_data->fd, cond);
+ proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE);
}
static void
+http_canwrite(gpointer data, gint source, PurpleInputCondition cond) {
+ PurpleProxyConnectData *connect_data = data;
+ int ret, error = ETIMEDOUT;
+
+ purple_debug_info("proxy", "Connected to %s:%d.\n",
+ connect_data->host, connect_data->port);
+
+ if (connect_data->inpa > 0) {
+ purple_input_remove(connect_data->inpa);
+ connect_data->inpa = 0;
+ }
+
+ ret = purple_input_get_error(connect_data->fd, &error);
+ if (ret != 0 || error != 0) {
+ if (ret != 0)
+ error = errno;
+ purple_proxy_connect_data_disconnect(connect_data, g_strerror(error));
+ return;
+ }
+
+ if (connect_data->port == 80) {
+ /*
+ * If we're trying to connect to something running on
+ * port 80 then we assume the traffic using this
+ * connection is going to be HTTP traffic. If it's
+ * not then this will fail (uglily). But it's good
+ * to avoid using the CONNECT method because it's
+ * not always allowed.
+ */
+ purple_debug_info("proxy", "HTTP proxy connection established\n");
+ purple_proxy_connect_data_connected(connect_data);
+ } else {
+ http_start_connect_tunneling(connect_data);
+ }
+
+}
+
+static void
proxy_connect_http(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen)
{
int flags;
@@ -940,39 +955,15 @@ proxy_connect_http(PurpleProxyConnectDat
fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC);
#endif
- if (connect(connect_data->fd, addr, addrlen) != 0)
- {
- if ((errno == EINPROGRESS) || (errno == EINTR))
- {
+ if (connect(connect_data->fd, addr, addrlen) != 0) {
+ if (errno == EINPROGRESS || errno == EINTR) {
purple_debug_info("proxy", "Connection in progress\n");
- if (connect_data->port != 80)
- {
- /* we need to do CONNECT first */
- connect_data->inpa = purple_input_add(connect_data->fd,
- PURPLE_INPUT_WRITE, http_canwrite, connect_data);
- }
- else
- {
- /*
- * If we're trying to connect to something running on
- * port 80 then we assume the traffic using this
- * connection is going to be HTTP traffic. If it's
- * not then this will fail (uglily). But it's good
- * to avoid using the CONNECT method because it's
- * not always allowed.
- */
- purple_debug_info("proxy", "HTTP proxy connection established\n");
- purple_proxy_connect_data_connected(connect_data);
- }
- }
- else
- {
+ connect_data->inpa = purple_input_add(connect_data->fd,
+ PURPLE_INPUT_WRITE, http_canwrite, connect_data);
+ } else
purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno));
- }
- }
- else
- {
+ } else {
purple_debug_info("proxy", "Connected immediately.\n");
http_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE);
More information about the Commits
mailing list