libpurple/protocols/msn/soap.c

Fri, 09 Aug 2013 13:03:26 +0200

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Fri, 09 Aug 2013 13:03:26 +0200
changeset 34287
6cd0c77b1f6a
parent 34265
e6de87604147
child 34935
686fa55b0deb
permissions
-rw-r--r--

HTTP: successful is spelled with one l

21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
1 /**
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23798
diff changeset
2 * @file soap.c
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
3 * Functions relating to SOAP connections.
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
4 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
5 * purple
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
6 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
7 * Purple is the legal property of its developers, whose names are too numerous
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
9 * source distribution.
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
10 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
15 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
20 *
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
28345
57a838c454b0 Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <darkrain42@pidgin.im>
parents: 28323
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
24 */
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
25
23819
c3bbef4646b1 Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23798
diff changeset
26 #include "soap.h"
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
27
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
28 #include "debug.h"
34264
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
29 #include "http.h"
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
30
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
31 typedef struct _MsnSoapRequest MsnSoapRequest;
24075
7c07336ce376 I seem to have accidentally turned on those "unsafe" SOAP debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24045
diff changeset
32
34264
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
33 struct _MsnSoapMessage {
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
34 gchar *action;
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
35 xmlnode *xml;
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
36 };
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
37
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
38 struct _MsnSoapRequest {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
39 MsnSoapMessage *message;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
40 MsnSoapService *soaps;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
41 MsnSoapCallback cb;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
42 gpointer cb_data;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
43 gboolean secure;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
44 };
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
45
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
46 struct _MsnSoapService {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
47 MsnSession *session;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
48 PurpleHttpKeepalivePool *keepalive_pool;
34264
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
49 };
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
50
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
51 static void
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
52 msn_soap_service_send_message_simple(MsnSoapService *soaps,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
53 MsnSoapMessage *message, const gchar *url, gboolean secure,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
54 MsnSoapCallback cb, gpointer cb_data);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
55
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
56 MsnSoapMessage *
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
57 msn_soap_message_new(const gchar *action, xmlnode *xml)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
58 {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
59 MsnSoapMessage *msg;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
60
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
61 g_return_val_if_fail(xml != NULL, NULL);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
62
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
63 msg = g_new0(MsnSoapMessage, 1);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
64 msg->action = g_strdup(action);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
65 msg->xml = xml;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
66
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
67 return msg;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
68 }
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
69
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
70 static void
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
71 msn_soap_message_free(MsnSoapMessage *msg)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
72 {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
73 if (msg == NULL)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
74 return;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
75
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
76 g_free(msg->action);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
77 if (msg->xml != NULL)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
78 xmlnode_free(msg->xml);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
79 g_free(msg);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
80 }
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
81
34264
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
82 xmlnode *
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
83 msn_soap_message_get_xml(MsnSoapMessage *message)
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
84 {
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
85 g_return_val_if_fail(message != NULL, NULL);
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
86
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
87 return message->xml;
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
88 }
e531664a3ad1 HTTP: purify internal API for msn's SOAP handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34219
diff changeset
89
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
90 static void
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
91 msn_soap_request_free(MsnSoapRequest *sreq)
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
92 {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
93 g_return_if_fail(sreq != NULL);
24794
1f4f77e2e111 Use separate variables to keep track of the timer and the watcher.
Mark Doliner <markdoliner@pidgin.im>
parents: 24793
diff changeset
94
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
95 msn_soap_message_free(sreq->message);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
96 g_free(sreq);
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
97 }
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
98
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
99 MsnSoapService *
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
100 msn_soap_service_new(MsnSession *session)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
101 {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
102 MsnSoapService *soaps;
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
103
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
104 g_return_val_if_fail(session != NULL, NULL);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
105
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
106 soaps = g_new0(MsnSoapService, 1);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
107 soaps->session = session;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
108 soaps->keepalive_pool = purple_http_keepalive_pool_new();
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
109 purple_http_keepalive_pool_set_limit_per_host(soaps->keepalive_pool, 1);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
110
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
111 return soaps;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
112 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
113
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
114 void
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
115 msn_soap_service_destroy(MsnSoapService *soaps)
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
116 {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
117 if (soaps == NULL)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
118 return;
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
119
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
120 purple_http_keepalive_pool_unref(soaps->keepalive_pool);
21672
cb25ada4f6a0 soap faults are now properly handled
Ka-Hing Cheung <khc@pidgin.im>
parents: 21398
diff changeset
121
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
122 g_free(soaps);
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
123 }
21398
a31c84608fcb read as much from the fd as possible if we get a read event, hopefully will
Ka-Hing Cheung <khc@pidgin.im>
parents: 21391
diff changeset
124
23469
74429b4ad296 Patch from tomgr and Maiku that workarounds some OS X issue,
Ka-Hing Cheung <khc@pidgin.im>
parents: 23078
diff changeset
125 static void
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
126 msn_soap_service_recv(PurpleHttpConnection *http_conn,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
127 PurpleHttpResponse *response, gpointer _sreq)
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
128 {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
129 MsnSoapRequest *sreq = _sreq;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
130 xmlnode *xml_root, *xml_body, *xml_fault;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
131 const gchar *xml_raw;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
132 size_t xml_len;
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
133
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
134 if (purple_http_response_get_code(response) == 401) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
135 const gchar *errmsg;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
136
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
137 purple_debug_error("msn-soap", "SOAP authentication failed\n");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
138
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
139 errmsg = purple_http_response_get_header(response,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
140 "WWW-Authenticate");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
141
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
142 msn_session_set_error(sreq->soaps->session, MSN_ERROR_AUTH,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
143 errmsg ? purple_url_decode(errmsg) : NULL);
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
144
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
145 msn_soap_request_free(sreq);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
146 return;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
147 }
34287
6cd0c77b1f6a HTTP: successful is spelled with one l
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34265
diff changeset
148 if (!purple_http_response_is_successful(response)) {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
149 purple_debug_error("msn-soap", "SOAP request failed\n");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
150 msn_session_set_error(sreq->soaps->session,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
151 MSN_ERROR_SERV_UNAVAILABLE, NULL);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
152 msn_soap_request_free(sreq);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
153 return;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
154 }
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
155
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
156 xml_raw = purple_http_response_get_data(response, &xml_len);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
157 xml_root = xmlnode_from_str(xml_raw, xml_len);
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
158
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
159 if (purple_debug_is_verbose()) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
160 if (sreq->secure && !purple_debug_is_unsafe()) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
161 purple_debug_misc("msn-soap",
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
162 "Received secure SOAP request.\n");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
163 } else {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
164 purple_debug_misc("msn-soap",
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
165 "Received SOAP request: %s\n", xml_raw);
21361
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
166 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
167 }
f890366c8ec6 oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@pidgin.im>
parents: 21360
diff changeset
168
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
169 if (xml_root == NULL) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
170 purple_debug_error("msn-soap", "SOAP response malformed\n");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
171 msn_session_set_error(sreq->soaps->session,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
172 MSN_ERROR_HTTP_MALFORMED, NULL);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
173 msn_soap_request_free(sreq);
21354
5c6020f03f2d mostly done with soap level parsing, compiles
Ka-Hing Cheung <khc@pidgin.im>
parents: 21353
diff changeset
174 return;
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
175 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
176
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
177 xml_body = xmlnode_get_child(xml_root, "Body");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
178 xml_fault = xmlnode_get_child(xml_root, "Fault");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
179
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
180 if (xml_fault != NULL) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
181 xmlnode *xml_faultcode;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
182 gchar *faultdata = NULL;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
183
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
184 xml_faultcode = xmlnode_get_child(xml_fault, "faultcode");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
185 if (xml_faultcode != NULL)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
186 faultdata = xmlnode_get_data(xml_faultcode);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
187
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
188 if (g_strcmp0(faultdata, "psf:Redirect") == 0) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
189 xmlnode *xml_url;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
190 gchar *url = NULL;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
191
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
192 xml_url = xmlnode_get_child(xml_fault, "redirectUrl");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
193 if (xml_url != NULL)
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
194 url = xmlnode_get_data(xml_url);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
195
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
196 msn_soap_service_send_message_simple(sreq->soaps,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
197 sreq->message, url, sreq->secure, sreq->cb,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
198 sreq->cb_data);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
199
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
200 /* Steal the message, passed to another call. */
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
201 sreq->message = NULL;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
202 msn_soap_request_free(sreq);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
203
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
204 g_free(url);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
205 g_free(faultdata);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
206 return;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
207 }
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
208 if (g_strcmp0(faultdata, "wsse:FailedAuthentication") == 0) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
209 xmlnode *xml_reason =
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
210 xmlnode_get_child(xml_fault, "faultstring");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
211 gchar *reasondata = xmlnode_get_data(xml_reason);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
212
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
213 msn_session_set_error(sreq->soaps->session, MSN_ERROR_AUTH,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
214 reasondata);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
215
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
216 g_free(reasondata);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
217 g_free(faultdata);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
218 msn_soap_request_free(sreq);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
219 return;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
220 }
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
221 g_free(faultdata);
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
222 }
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
223
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
224 if (xml_fault != NULL || xml_body != NULL) {
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
225 MsnSoapMessage *resp;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
226
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
227 resp = msn_soap_message_new(NULL, xml_root);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
228 sreq->cb(sreq->message, resp, sreq->cb_data);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
229 msn_soap_message_free(resp);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
230 }
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
231
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
232 /* XXX: shouldn't msn_session_set_error here? */
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
233 msn_soap_request_free(sreq);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
234 }
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
235
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
236 static void
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
237 msn_soap_service_send_message_simple(MsnSoapService *soaps,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
238 MsnSoapMessage *message, const gchar *url, gboolean secure,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
239 MsnSoapCallback cb, gpointer cb_data)
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
240 {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
241 PurpleHttpRequest *hreq;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
242 MsnSoapRequest *sreq;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
243 gchar *body;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
244 int body_len;
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
245
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
246 sreq = g_new0(MsnSoapRequest, 1);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
247 sreq->soaps = soaps;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
248 sreq->cb = cb;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
249 sreq->cb_data = cb_data;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
250 sreq->secure = secure;
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
251 sreq->message = message;
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
252
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
253 hreq = purple_http_request_new(url);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
254 purple_http_request_set_method(hreq, "POST");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
255 purple_http_request_set_keepalive_pool(hreq, soaps->keepalive_pool);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
256 purple_http_request_header_set(hreq, "SOAPAction",
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
257 message->action ? message->action : "");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
258 purple_http_request_header_set(hreq, "Content-Type",
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
259 "text/xml; charset=utf-8");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
260 purple_http_request_header_set(hreq, "User-Agent",
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
261 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
262 purple_http_request_header_set(hreq, "Cache-Control", "no-cache");
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
263
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
264 body = xmlnode_to_str(message->xml, &body_len);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
265 purple_http_request_set_contents(hreq, body, body_len);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
266 g_free(body);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
267
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
268 purple_http_request(purple_account_get_connection(
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
269 soaps->session->account), hreq, msn_soap_service_recv, sreq);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
270 purple_http_request_unref(hreq);
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
271 }
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
272
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
273 void
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
274 msn_soap_service_send_message(MsnSoapService *soaps, MsnSoapMessage *message,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
275 const gchar *host, const gchar *path, gboolean secure,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
276 MsnSoapCallback cb, gpointer cb_data)
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
277 {
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
278 gchar *url;
24791
6e1d82706043 Minor whitespace changes and shuffle functions around to be in a more
Mark Doliner <markdoliner@pidgin.im>
parents: 24713
diff changeset
279
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
280 g_return_if_fail(host != NULL);
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
281 g_return_if_fail(path != NULL);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
282
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
283 if (path[0] == '/')
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
284 path = &path[1];
21355
500740852250 removes public handle to soap connection, instead a connection is looked up
Ka-Hing Cheung <khc@pidgin.im>
parents: 21354
diff changeset
285
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
286 url = g_strdup_printf("https://%s/%s", host, path);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
287
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
288 msn_soap_service_send_message_simple(soaps, message, url, secure,
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
289 cb, cb_data);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
290
34265
e6de87604147 HTTP: get rid of the second msn's own HTTP implementation (for soap)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34264
diff changeset
291 g_free(url);
21353
a70d31127cb6 beginning of soap layer rewrite, does that even compile?
Ka-Hing Cheung <khc@pidgin.im>
parents:
diff changeset
292 }

mercurial