Tue, 14 Dec 2021 01:55:51 -0600
Switch SoupURI to GUri
The former has been removed from libsoup 3, and the latter only added to GLib 2.66, but we depend on that version now. So in most cases we can simply replace it directly.
Testing Done:
Compiled against libsoup 2 and 3.
Reviewed at https://reviews.imfreedom.org/r/1185/
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
2 | * purple - Jabber Protocol Plugin |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28079
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28079
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28079
diff
changeset
|
6 | * source distribution. |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
7 | * |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
12 | * |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
17 | * |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
21 | * |
|
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
22 | */ |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
24 | |
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
40336
diff
changeset
|
25 | #include <purple.h> |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
26 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
27 | #include <libsoup/soup.h> |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
28 | |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
29 | #include "bosh.h" |
|
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
30 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
31 | /* |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
32 | TODO: test, what happens, if the http server (BOSH server) doesn't support |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
33 | keep-alive (sends connection: close). |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
34 | */ |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
35 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
36 | #define JABBER_BOSH_SEND_DELAY 250 |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
37 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
38 | #define JABBER_BOSH_TIMEOUT 10 |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
39 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
40 | static gchar *jabber_bosh_useragent = NULL; |
|
28062
f743d255c355
jabber: Re-order the BOSH structs and normalize the buffer names.
Paul Aurich <darkrain42@pidgin.im>
parents:
27811
diff
changeset
|
41 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
42 | struct _PurpleJabberBOSHConnection { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
43 | JabberStream *js; |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
44 | SoupSession *payload_reqs; |
|
28062
f743d255c355
jabber: Re-order the BOSH structs and normalize the buffer names.
Paul Aurich <darkrain42@pidgin.im>
parents:
27811
diff
changeset
|
45 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
46 | gchar *url; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
47 | gboolean is_ssl; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
48 | gboolean is_terminating; |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
49 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
50 | gchar *sid; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
51 | guint64 rid; /* Must be big enough to hold 2^53 - 1 */ |
|
26083
e716012de66e
Rearrange the structs and fix the indentation. No functional changes.
Paul Aurich <darkrain42@pidgin.im>
parents:
26082
diff
changeset
|
52 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
53 | GString *send_buff; |
|
28072
208dfa375b79
jabber: Add a BOSH send timer (queue up stanzas), fixes connecting to Prosody
Paul Aurich <darkrain42@pidgin.im>
parents:
28066
diff
changeset
|
54 | guint send_timer; |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
55 | }; |
|
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
56 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
57 | static SoupMessage *jabber_bosh_connection_http_request_new( |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
58 | PurpleJabberBOSHConnection *conn, const GString *data); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
59 | static void |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
60 | jabber_bosh_connection_session_create(PurpleJabberBOSHConnection *conn); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
61 | static void |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
62 | jabber_bosh_connection_send_now(PurpleJabberBOSHConnection *conn); |
|
23607
bc82598d3798
* looking for alternative connection methods if direct connection fails
Tobias Markmann <tfar@soc.pidgin.im>
parents:
diff
changeset
|
63 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
64 | void |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
65 | jabber_bosh_init(void) |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
66 | { |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
67 | PurpleUiInfo *ui_info = purple_core_get_ui_info(); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
68 | const gchar *ui_name = NULL; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
69 | const gchar *ui_version = NULL; |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
70 | |
|
40336
4e766d681de5
purple_core_get_ui_info now transfers the PurpleUiInfo to the caller, so we need to make sure to not cache it.
Gary Kramlich <grim@reaperworld.com>
parents:
40312
diff
changeset
|
71 | if(PURPLE_IS_UI_INFO(ui_info)) { |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
72 | ui_name = purple_ui_info_get_name(ui_info); |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
73 | ui_version = purple_ui_info_get_version(ui_info); |
|
25487
00e94f044205
The BOSH User Agent should include the client name (and optionally version),
Paul Aurich <darkrain42@pidgin.im>
parents:
25486
diff
changeset
|
74 | } |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
75 | |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
76 | if(ui_name) { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
77 | jabber_bosh_useragent = g_strdup_printf( |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
78 | "%s%s%s (libpurple " VERSION ")", ui_name, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
79 | ui_version ? " " : "", ui_version ? ui_version : ""); |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
80 | } else { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
81 | jabber_bosh_useragent = g_strdup("libpurple " VERSION); |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
82 | } |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
83 | |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
84 | if(ui_info) { |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
85 | g_object_unref(G_OBJECT(ui_info)); |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
40112
diff
changeset
|
86 | } |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
87 | } |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
88 | |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
89 | void jabber_bosh_uninit(void) |
|
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
90 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
91 | g_free(jabber_bosh_useragent); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
92 | jabber_bosh_useragent = NULL; |
|
24874
33902e1daba1
Reorder some functions to eliminate prototypes and
Paul Aurich <darkrain42@pidgin.im>
parents:
24873
diff
changeset
|
93 | } |
|
33902e1daba1
Reorder some functions to eliminate prototypes and
Paul Aurich <darkrain42@pidgin.im>
parents:
24873
diff
changeset
|
94 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
95 | PurpleJabberBOSHConnection* |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
96 | jabber_bosh_connection_new(JabberStream *js, const gchar *url) |
|
24874
33902e1daba1
Reorder some functions to eliminate prototypes and
Paul Aurich <darkrain42@pidgin.im>
parents:
24873
diff
changeset
|
97 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
98 | PurpleJabberBOSHConnection *conn; |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
99 | PurpleAccount *account; |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
100 | GProxyResolver *resolver; |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
101 | GError *error = NULL; |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40819
diff
changeset
|
102 | const gchar *scheme; |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
103 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
104 | account = purple_connection_get_account(js->gc); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
105 | resolver = purple_proxy_get_proxy_resolver(account, &error); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
106 | if (resolver == NULL) { |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
107 | purple_debug_error("jabber-bosh", |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
108 | "Unable to get account proxy resolver: %s", |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
109 | error->message); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
110 | g_error_free(error); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
111 | return NULL; |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
112 | } |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
113 | |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40819
diff
changeset
|
114 | scheme = g_uri_peek_scheme(url); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40819
diff
changeset
|
115 | if (scheme == NULL) { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
116 | purple_debug_error("jabber-bosh", "Unable to parse given BOSH URL: %s", |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
117 | url); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
118 | g_object_unref(resolver); |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
119 | return NULL; |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
120 | } |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
121 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
122 | conn = g_new0(PurpleJabberBOSHConnection, 1); |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
123 | conn->payload_reqs = soup_session_new_with_options( |
|
40819
54b2a95ac176
Cleanup deprecated libsoup usage
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
124 | "proxy-resolver", resolver, |
|
54b2a95ac176
Cleanup deprecated libsoup usage
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
125 | "timeout", JABBER_BOSH_TIMEOUT + 2, |
|
54b2a95ac176
Cleanup deprecated libsoup usage
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
126 | "user-agent", jabber_bosh_useragent, |
|
54b2a95ac176
Cleanup deprecated libsoup usage
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
127 | NULL); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
128 | conn->url = g_strdup(url); |
|
23613
1da7c5cbcc54
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23612
diff
changeset
|
129 | conn->js = js; |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40819
diff
changeset
|
130 | conn->is_ssl = g_str_equal(scheme, "https"); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
131 | conn->send_buff = g_string_new(NULL); |
|
26672
d424e92111b5
A better random number for the rid in the range [0, 2**52).
Paul Aurich <darkrain42@pidgin.im>
parents:
26664
diff
changeset
|
132 | |
|
d424e92111b5
A better random number for the rid in the range [0, 2**52).
Paul Aurich <darkrain42@pidgin.im>
parents:
26664
diff
changeset
|
133 | /* |
|
d424e92111b5
A better random number for the rid in the range [0, 2**52).
Paul Aurich <darkrain42@pidgin.im>
parents:
26664
diff
changeset
|
134 | * Random 64-bit integer masked off by 2^52 - 1. |
|
d424e92111b5
A better random number for the rid in the range [0, 2**52).
Paul Aurich <darkrain42@pidgin.im>
parents:
26664
diff
changeset
|
135 | * |
|
d424e92111b5
A better random number for the rid in the range [0, 2**52).
Paul Aurich <darkrain42@pidgin.im>
parents:
26664
diff
changeset
|
136 | * This should produce a random integer in the range [0, 2^52). It's |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
137 | * unlikely we'll send enough packets in one session to overflow the |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
138 | * rid. |
|
26672
d424e92111b5
A better random number for the rid in the range [0, 2**52).
Paul Aurich <darkrain42@pidgin.im>
parents:
26664
diff
changeset
|
139 | */ |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
140 | conn->rid = (((guint64)g_random_int() << 32) | g_random_int()); |
|
26967
b52a6393cc13
Windows compilation complains (probably because it's 32-bit)
Paul Aurich <darkrain42@pidgin.im>
parents:
26673
diff
changeset
|
141 | conn->rid &= 0xFFFFFFFFFFFFFLL; |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
142 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
143 | g_object_unref(resolver); |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
144 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
145 | jabber_bosh_connection_session_create(conn); |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
146 | |
|
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
147 | return conn; |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
148 | } |
|
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
149 | |
|
24874
33902e1daba1
Reorder some functions to eliminate prototypes and
Paul Aurich <darkrain42@pidgin.im>
parents:
24873
diff
changeset
|
150 | void |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
151 | jabber_bosh_connection_destroy(PurpleJabberBOSHConnection *conn) |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
152 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
153 | if (conn == NULL || conn->is_terminating) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
154 | return; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
155 | conn->is_terminating = TRUE; |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
156 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
157 | if (conn->sid != NULL) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
158 | purple_debug_info("jabber-bosh", |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
159 | "Terminating a session for %p\n", conn); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
160 | jabber_bosh_connection_send_now(conn); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
161 | } |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
162 | |
|
28072
208dfa375b79
jabber: Add a BOSH send timer (queue up stanzas), fixes connecting to Prosody
Paul Aurich <darkrain42@pidgin.im>
parents:
28066
diff
changeset
|
163 | if (conn->send_timer) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
164 | g_source_remove(conn->send_timer); |
|
26082
7e3952f2713d
Obey the 'inactivity' attribute and send blank updates often enough. Also,
Paul Aurich <darkrain42@pidgin.im>
parents:
26081
diff
changeset
|
165 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
166 | soup_session_abort(conn->payload_reqs); |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
167 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
168 | g_clear_object(&conn->payload_reqs); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
169 | g_string_free(conn->send_buff, TRUE); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
170 | conn->send_buff = NULL; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
171 | |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
172 | g_free(conn->sid); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
173 | conn->sid = NULL; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
174 | g_free(conn->url); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
175 | conn->url = NULL; |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
176 | |
|
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
177 | g_free(conn); |
|
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
178 | } |
|
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
179 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
180 | gboolean |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
181 | jabber_bosh_connection_is_ssl(const PurpleJabberBOSHConnection *conn) |
|
26533
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26085
diff
changeset
|
182 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
183 | return conn->is_ssl; |
|
26533
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26085
diff
changeset
|
184 | } |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26085
diff
changeset
|
185 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
186 | static PurpleXmlNode * |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
187 | jabber_bosh_connection_parse(PurpleJabberBOSHConnection *conn, |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
188 | SoupMessage *response) |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
189 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
190 | PurpleXmlNode *root; |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
191 | const gchar *type; |
|
28066
6e27a78baf3d
jabber: Ridiculously verbose logging for BOSH.
Paul Aurich <darkrain42@pidgin.im>
parents:
28065
diff
changeset
|
192 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
193 | g_return_val_if_fail(conn != NULL, NULL); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
194 | g_return_val_if_fail(response != NULL, NULL); |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
195 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
196 | if (conn->is_terminating || purple_account_is_disconnecting( |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
197 | purple_connection_get_account(conn->js->gc))) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
198 | { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
199 | return NULL; |
|
27811
9db18cacd8fc
Various fixes to get BOSH working with Prosody 0.5.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
200 | } |
|
9db18cacd8fc
Various fixes to get BOSH working with Prosody 0.5.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
201 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
202 | if (!SOUP_STATUS_IS_SUCCESSFUL(response->status_code)) { |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
203 | gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
204 | response->reason_phrase); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
205 | purple_connection_error(conn->js->gc, |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
206 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
207 | g_free(tmp); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
208 | return NULL; |
|
31360
4ddd59618002
jabber: Be friendlier to servers when we have nothing to say.
Paul Aurich <darkrain42@pidgin.im>
parents:
31350
diff
changeset
|
209 | } |
|
4ddd59618002
jabber: Be friendlier to servers when we have nothing to say.
Paul Aurich <darkrain42@pidgin.im>
parents:
31350
diff
changeset
|
210 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
211 | root = purple_xmlnode_from_str(response->response_body->data, |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
212 | response->response_body->length); |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
213 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
214 | type = purple_xmlnode_get_attrib(root, "type"); |
| 38358 | 215 | if (purple_strequal(type, "terminate")) { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
216 | purple_connection_error(conn->js->gc, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
217 | PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("The BOSH " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
218 | "connection manager terminated your session.")); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
219 | purple_xmlnode_free(root); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
220 | return NULL; |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
221 | } |
|
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
222 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
223 | return root; |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
224 | } |
|
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
225 | |
|
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
226 | static void |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
227 | jabber_bosh_connection_recv(SoupSession *session, SoupMessage *msg, |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
228 | gpointer user_data) |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
229 | { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
230 | PurpleJabberBOSHConnection *bosh_conn = user_data; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
231 | PurpleXmlNode *node, *child; |
|
27811
9db18cacd8fc
Various fixes to get BOSH working with Prosody 0.5.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
232 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
233 | if (purple_debug_is_verbose() && purple_debug_is_unsafe()) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
234 | purple_debug_misc("jabber-bosh", "received: %s\n", |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
235 | msg->response_body->data); |
|
26664
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
236 | } |
|
a42da6facb80
Reorder functions to remove prototypes
Paul Aurich <darkrain42@pidgin.im>
parents:
26661
diff
changeset
|
237 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
238 | node = jabber_bosh_connection_parse(bosh_conn, msg); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
239 | if (node == NULL) |
|
24875
0fa0cf6ea28e
Make the Request ID a long long (fit in 2^53-1)
Paul Aurich <darkrain42@pidgin.im>
parents:
24874
diff
changeset
|
240 | return; |
|
0fa0cf6ea28e
Make the Request ID a long long (fit in 2^53-1)
Paul Aurich <darkrain42@pidgin.im>
parents:
24874
diff
changeset
|
241 | |
|
23620
e306af5178d7
* data buffer for received data. Support for any HTTP resonse size now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23619
diff
changeset
|
242 | child = node->child; |
|
24875
0fa0cf6ea28e
Make the Request ID a long long (fit in 2^53-1)
Paul Aurich <darkrain42@pidgin.im>
parents:
24874
diff
changeset
|
243 | while (child != NULL) { |
|
24886
de0388948ac8
Jabber BOSH: memory management fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
24885
diff
changeset
|
244 | /* jabber_process_packet might free child */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
245 | PurpleXmlNode *next = child->next; |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
246 | const gchar *xmlns; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
247 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
248 | if (child->type != PURPLE_XMLNODE_TYPE_TAG) { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
249 | child = next; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
250 | continue; |
|
23620
e306af5178d7
* data buffer for received data. Support for any HTTP resonse size now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23619
diff
changeset
|
251 | } |
|
24886
de0388948ac8
Jabber BOSH: memory management fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
24885
diff
changeset
|
252 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
253 | /* Workaround for non-compliant servers that don't stamp |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
254 | * the right xmlns on these packets. See #11315. |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
255 | */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
256 | xmlns = purple_xmlnode_get_namespace(child); |
| 38358 | 257 | if ((xmlns == NULL || purple_strequal(xmlns, NS_BOSH)) && |
| 258 | (purple_strequal(child->name, "iq") || | |
| 259 | purple_strequal(child->name, "message") || | |
| 260 | purple_strequal(child->name, "presence"))) | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
261 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
262 | purple_xmlnode_set_namespace(child, NS_XMPP_CLIENT); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
263 | } |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
264 | |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
265 | jabber_process_packet(bosh_conn->js, &child); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
266 | |
|
24886
de0388948ac8
Jabber BOSH: memory management fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
24885
diff
changeset
|
267 | child = next; |
|
23620
e306af5178d7
* data buffer for received data. Support for any HTTP resonse size now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23619
diff
changeset
|
268 | } |
|
23619
5c215ab46f1e
* moving BOSH interfacing from jabber_send to jabber_send_raw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23618
diff
changeset
|
269 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
270 | jabber_bosh_connection_send(bosh_conn, NULL); |
|
23618
8497c2f5e62d
* using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23617
diff
changeset
|
271 | } |
|
8497c2f5e62d
* using libpurple's internal SASL mechanisms during BOSH authentication phase
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23617
diff
changeset
|
272 | |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
273 | static void |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
274 | jabber_bosh_connection_send_now(PurpleJabberBOSHConnection *conn) |
|
26078
3526ac955ce3
Rename a few functions and drop some data members.
Paul Aurich <darkrain42@pidgin.im>
parents:
26076
diff
changeset
|
275 | { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
276 | SoupMessage *req; |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
277 | GString *data; |
|
31349
dd0d5d14b148
jabber: Make the BOSH parsing a little more resilient and add more diagnostic output
Paul Aurich <darkrain42@pidgin.im>
parents:
31348
diff
changeset
|
278 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
279 | g_return_if_fail(conn != NULL); |
|
23621
d7a6cc7ca517
* sending empty <body> requests if there are not othere requests to be answered to keep a CM -> client channel open
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23620
diff
changeset
|
280 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
281 | if (conn->send_timer != 0) { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
282 | g_source_remove(conn->send_timer); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
283 | conn->send_timer = 0; |
|
26533
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26085
diff
changeset
|
284 | } |
|
5c74696c34d1
BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream.
Paul Aurich <darkrain42@pidgin.im>
parents:
26085
diff
changeset
|
285 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
286 | if (conn->sid == NULL) |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
287 | return; |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
288 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
289 | data = g_string_new(NULL); |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
290 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
291 | /* missing parameters: route, from, ack */ |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
292 | g_string_printf(data, "<body " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
293 | "rid='%" G_GUINT64_FORMAT "' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
294 | "sid='%s' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
295 | "xmlns='" NS_BOSH "' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
296 | "xmlns:xmpp='" NS_XMPP_BOSH "' ", |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
297 | ++conn->rid, conn->sid); |
|
26076
1755f871f1d1
Restore BOSH to a more-or-less working state.
Paul Aurich <darkrain42@pidgin.im>
parents:
25489
diff
changeset
|
298 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
299 | if (conn->js->reinit && !conn->is_terminating) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
300 | g_string_append(data, "xmpp:restart='true'/>"); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
301 | conn->js->reinit = FALSE; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
302 | } else { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
303 | if (conn->is_terminating) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
304 | g_string_append(data, "type='terminate' "); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
305 | g_string_append_c(data, '>'); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
306 | g_string_append_len(data, conn->send_buff->str, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
307 | conn->send_buff->len); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
308 | g_string_append(data, "</body>"); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
309 | g_string_set_size(conn->send_buff, 0); |
|
28066
6e27a78baf3d
jabber: Ridiculously verbose logging for BOSH.
Paul Aurich <darkrain42@pidgin.im>
parents:
28065
diff
changeset
|
310 | } |
|
28079
69fc36a9cbe3
jabber: Keep a second connection open over which to send the terminate.
Paul Aurich <darkrain42@pidgin.im>
parents:
28072
diff
changeset
|
311 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
312 | if (purple_debug_is_verbose() && purple_debug_is_unsafe()) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
313 | purple_debug_misc("jabber-bosh", "sending: %s\n", data->str); |
|
31360
4ddd59618002
jabber: Be friendlier to servers when we have nothing to say.
Paul Aurich <darkrain42@pidgin.im>
parents:
31350
diff
changeset
|
314 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
315 | req = jabber_bosh_connection_http_request_new(conn, data); |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
316 | g_string_free(data, FALSE); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
317 | |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
318 | if (conn->is_terminating) { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
319 | soup_session_send_async(conn->payload_reqs, req, NULL, NULL, NULL); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
320 | g_free(conn->sid); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
321 | conn->sid = NULL; |
|
26534
20a970cad8e2
Because BOSH works over connections that may die non-fatally, we need to
Paul Aurich <darkrain42@pidgin.im>
parents:
26533
diff
changeset
|
322 | } else { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
323 | soup_session_queue_message(conn->payload_reqs, req, |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
324 | jabber_bosh_connection_recv, conn); |
|
26534
20a970cad8e2
Because BOSH works over connections that may die non-fatally, we need to
Paul Aurich <darkrain42@pidgin.im>
parents:
26533
diff
changeset
|
325 | } |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
326 | } |
|
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
327 | |
|
35264
5b9619d1dec4
Fix dropping incoming stanzas on BOSH connections when we receive
Mark Doliner <mark@kingant.net>
parents:
35263
diff
changeset
|
328 | static gboolean |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
329 | jabber_bosh_connection_send_delayed(gpointer _conn) |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
330 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
331 | PurpleJabberBOSHConnection *conn = _conn; |
|
31350
c4038b151558
jabber: Handle the connection: close header. Closes #13008
Paul Aurich <darkrain42@pidgin.im>
parents:
31349
diff
changeset
|
332 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
333 | conn->send_timer = 0; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
334 | jabber_bosh_connection_send_now(conn); |
|
35264
5b9619d1dec4
Fix dropping incoming stanzas on BOSH connections when we receive
Mark Doliner <mark@kingant.net>
parents:
35263
diff
changeset
|
335 | |
|
5b9619d1dec4
Fix dropping incoming stanzas on BOSH connections when we receive
Mark Doliner <mark@kingant.net>
parents:
35263
diff
changeset
|
336 | return FALSE; |
|
23620
e306af5178d7
* data buffer for received data. Support for any HTTP resonse size now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23619
diff
changeset
|
337 | } |
|
e306af5178d7
* data buffer for received data. Support for any HTTP resonse size now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23619
diff
changeset
|
338 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
339 | void |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
340 | jabber_bosh_connection_send(PurpleJabberBOSHConnection *conn, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
341 | const gchar *data) |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
342 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
343 | g_return_if_fail(conn != NULL); |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
344 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
345 | if (data) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
346 | g_string_append(conn->send_buff, data); |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
347 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
348 | if (conn->send_timer == 0) { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
349 | conn->send_timer = g_timeout_add( |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
350 | JABBER_BOSH_SEND_DELAY, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
351 | jabber_bosh_connection_send_delayed, conn); |
|
23614
cb637468e183
* preparing handling of multiple requests for pipelining support
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23613
diff
changeset
|
352 | } |
|
23612
0d8cc9f7f223
* adding receive callback; preparing receiving and boot code
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23611
diff
changeset
|
353 | } |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
354 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
355 | void |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
356 | jabber_bosh_connection_send_keepalive(PurpleJabberBOSHConnection *conn) |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
357 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
358 | g_return_if_fail(conn != NULL); |
| 27154 | 359 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
360 | jabber_bosh_connection_send_now(conn); |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
361 | } |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
362 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
363 | static gboolean |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
364 | jabber_bosh_version_check(const gchar *version, int major_req, int minor_min) |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
365 | { |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
366 | const gchar *dot; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
367 | int major, minor = 0; |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
368 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
369 | if (version == NULL) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
370 | return FALSE; |
|
26081
ef41d4bd0dfa
Clean up BOSH reading and disconnection handling.
Paul Aurich <darkrain42@pidgin.im>
parents:
26079
diff
changeset
|
371 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
372 | major = atoi(version); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
373 | dot = strchr(version, '.'); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
374 | if (dot) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
375 | minor = atoi(dot + 1); |
|
24884
896733ece217
Jabber BOSH: Model the parsing on the SOAP stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
24883
diff
changeset
|
376 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
377 | if (major != major_req) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
378 | return FALSE; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
379 | if (minor < minor_min) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
380 | return FALSE; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
381 | return TRUE; |
|
23612
0d8cc9f7f223
* adding receive callback; preparing receiving and boot code
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23611
diff
changeset
|
382 | } |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
383 | |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
384 | static void |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
385 | jabber_bosh_connection_session_created(SoupSession *session, SoupMessage *msg, |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
386 | gpointer user_data) |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
387 | { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
388 | PurpleJabberBOSHConnection *bosh_conn = user_data; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
389 | PurpleXmlNode *node, *features; |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
390 | const gchar *sid, *ver, *inactivity_str; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
391 | int inactivity = 0; |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
392 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
393 | if (purple_debug_is_verbose() && purple_debug_is_unsafe()) { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
394 | purple_debug_misc("jabber-bosh", "received (session creation): %s\n", |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
395 | msg->response_body->data); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
396 | } |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
397 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
398 | node = jabber_bosh_connection_parse(bosh_conn, msg); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
399 | if (node == NULL) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
400 | return; |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
401 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
402 | sid = purple_xmlnode_get_attrib(node, "sid"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
403 | ver = purple_xmlnode_get_attrib(node, "ver"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
404 | inactivity_str = purple_xmlnode_get_attrib(node, "inactivity"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
405 | /* requests = purple_xmlnode_get_attrib(node, "requests"); */ |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
406 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
407 | if (!sid) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
408 | purple_connection_error(bosh_conn->js->gc, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
409 | PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
410 | _("No BOSH session ID given")); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
411 | purple_xmlnode_free(node); |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
412 | return; |
|
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
413 | } |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
414 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
415 | if (ver == NULL) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
416 | purple_debug_info("jabber-bosh", "Missing version in BOSH initiation\n"); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
417 | } else if (!jabber_bosh_version_check(ver, 1, 6)) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
418 | purple_debug_error("jabber-bosh", |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
419 | "Unsupported BOSH version: %s\n", ver); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
420 | purple_connection_error(bosh_conn->js->gc, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
421 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
422 | _("Unsupported version of BOSH protocol")); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
423 | purple_xmlnode_free(node); |
|
23611
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
424 | return; |
|
d811757e19b5
* adding bosh files to Makefile.am & .mingw
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23609
diff
changeset
|
425 | } |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
426 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
427 | purple_debug_misc("jabber-bosh", "Session created for %p\n", bosh_conn); |
| 23609 | 428 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
429 | bosh_conn->sid = g_strdup(sid); |
|
27811
9db18cacd8fc
Various fixes to get BOSH working with Prosody 0.5.
Paul Aurich <darkrain42@pidgin.im>
parents:
27635
diff
changeset
|
430 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
431 | if (inactivity_str) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
432 | inactivity = atoi(inactivity_str); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
433 | if (inactivity < 0 || inactivity > 3600) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
434 | purple_debug_warning("jabber-bosh", "Ignoring invalid " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
435 | "inactivity value: %s\n", inactivity_str); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
436 | inactivity = 0; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
437 | } |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
438 | if (inactivity > 0) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
439 | inactivity -= 5; /* rounding */ |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
440 | if (inactivity <= 0) |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
441 | inactivity = 1; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
442 | bosh_conn->js->max_inactivity = inactivity; |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
443 | if (bosh_conn->js->inactivity_timer == 0) { |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
444 | purple_debug_misc("jabber-bosh", "Starting inactivity " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
445 | "timer for %d secs (compensating for " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
446 | "rounding)\n", inactivity); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
447 | jabber_stream_restart_inactivity_timer(bosh_conn->js); |
|
26085
6b5686df629c
BOSH: Support HTTPS connections to the connection manager
Paul Aurich <darkrain42@pidgin.im>
parents:
26084
diff
changeset
|
448 | } |
|
24872
68de61b562f6
Jabber BOSH: Many fixes
Paul Aurich <darkrain42@pidgin.im>
parents:
23625
diff
changeset
|
449 | } |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
450 | |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
451 | jabber_stream_set_state(bosh_conn->js, JABBER_STREAM_AUTHENTICATING); |
|
23613
1da7c5cbcc54
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23612
diff
changeset
|
452 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
453 | /* FIXME: Depending on receiving features might break with some hosts */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
454 | features = purple_xmlnode_get_child(node, "features"); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
455 | jabber_stream_features_parse(bosh_conn->js, features); |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
456 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34878
diff
changeset
|
457 | purple_xmlnode_free(node); |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
458 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
459 | jabber_bosh_connection_send(bosh_conn, NULL); |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
460 | } |
|
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
461 | |
|
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
462 | static void |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
463 | jabber_bosh_connection_session_create(PurpleJabberBOSHConnection *conn) |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
464 | { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
465 | SoupMessage *req; |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
466 | GString *data; |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
467 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
468 | purple_debug_misc("jabber-bosh", "Requesting Session Create for %p\n", |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
469 | conn); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
470 | |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
471 | data = g_string_new(NULL); |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
472 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
473 | /* missing optional parameters: route, from, ack */ |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
474 | g_string_printf(data, "<body content='text/xml; charset=utf-8' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
475 | "rid='%" G_GUINT64_FORMAT "' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
476 | "to='%s' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
477 | "xml:lang='en' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
478 | "ver='1.10' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
479 | "wait='%d' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
480 | "hold='1' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
481 | "xmlns='" NS_BOSH "' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
482 | "xmpp:version='1.0' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
483 | "xmlns:xmpp='urn:xmpp:xbosh' " |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
484 | "/>", |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
485 | ++conn->rid, conn->js->user->domain, JABBER_BOSH_TIMEOUT); |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
486 | |
|
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
487 | req = jabber_bosh_connection_http_request_new(conn, data); |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
488 | g_string_free(data, FALSE); |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
489 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
490 | soup_session_queue_message(conn->payload_reqs, req, |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
491 | jabber_bosh_connection_session_created, conn); |
|
26673
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
492 | } |
|
f632d4de4bce
BOSH: Use a write buffer (read: basically cut-n-paste from jabber.c)
Paul Aurich <darkrain42@pidgin.im>
parents:
26672
diff
changeset
|
493 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
494 | static SoupMessage * |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
495 | jabber_bosh_connection_http_request_new(PurpleJabberBOSHConnection *conn, |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
496 | const GString *data) |
|
24873
7d1e91d5ec46
Jabber BOSH: more fixes.
Paul Aurich <darkrain42@pidgin.im>
parents:
24872
diff
changeset
|
497 | { |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
498 | SoupMessage *req; |
|
28065
f9b9e38c98f4
jabber: Better inactivity timer logic.
Paul Aurich <darkrain42@pidgin.im>
parents:
28064
diff
changeset
|
499 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
500 | jabber_stream_restart_inactivity_timer(conn->js); |
|
28066
6e27a78baf3d
jabber: Ridiculously verbose logging for BOSH.
Paul Aurich <darkrain42@pidgin.im>
parents:
28065
diff
changeset
|
501 | |
|
40002
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
502 | req = soup_message_new("POST", conn->url); |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
503 | soup_message_set_request(req, "text/xml; charset=utf-8", SOUP_MEMORY_TAKE, |
|
f08d87a438c2
Convert Jabber BOSH to libsoup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39987
diff
changeset
|
504 | data->str, data->len); |
|
24883
c283f8737645
Jabber BOSH: Store less for each Request/Response
Paul Aurich <darkrain42@pidgin.im>
parents:
24875
diff
changeset
|
505 | |
|
34268
cf61366236ee
HTTP: connections set support added; BOSH for xmpp reimplemented, to use http API instead of its own HTTP implementation
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
506 | return req; |
|
23613
1da7c5cbcc54
* doing HTTP requests
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23612
diff
changeset
|
507 | } |