19784
|
1 /**
|
|
2 * @file soap.c
|
|
3 * SOAP connection related process
|
|
4 * Author
|
|
5 * MaYuan<mayuan2006@gmail.com>
|
|
6 * gaim
|
|
7 *
|
|
8 * Gaim is the legal property of its developers, whose names are too numerous
|
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
10 * source distribution.
|
|
11 *
|
|
12 * This program is free software; you can redistribute it and/or modify
|
|
13 * it under the terms of the GNU General Public License as published by
|
|
14 * the Free Software Foundation; either version 2 of the License, or
|
|
15 * (at your option) any later version.
|
|
16 *
|
|
17 * This program is distributed in the hope that it will be useful,
|
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 * GNU General Public License for more details.
|
|
21 *
|
|
22 * You should have received a copy of the GNU General Public License
|
|
23 * along with this program; if not, write to the Free Software
|
|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
25 */
|
|
26 #include "msn.h"
|
|
27 #include "soap.h"
|
|
28
|
19814
|
29 /*local function prototype*/
|
|
30 void msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step);
|
|
31
|
19807
|
32 /*setup the soap process step*/
|
19806
|
33 void
|
|
34 msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step)
|
|
35 {
|
|
36 soapconn->step = step;
|
|
37 }
|
|
38
|
19785
|
39 //msn_soap_new(MsnSession *session,gpointer data,int sslconn)
|
19784
|
40 /*new a soap connection*/
|
|
41 MsnSoapConn *
|
19785
|
42 msn_soap_new(MsnSession *session,gpointer data,int sslconn)
|
19784
|
43 {
|
|
44 MsnSoapConn *soapconn;
|
|
45
|
|
46 soapconn = g_new0(MsnSoapConn, 1);
|
|
47 soapconn->session = session;
|
19785
|
48 soapconn->parent = data;
|
|
49 soapconn->ssl_conn = sslconn;
|
|
50
|
|
51 soapconn->gsc = NULL;
|
19784
|
52 soapconn->input_handler = -1;
|
|
53 soapconn->output_handler = -1;
|
19804
|
54
|
19806
|
55 msn_soap_set_process_step(soapconn,MSN_SOAP_UNCONNECTED);
|
19804
|
56 soapconn->soap_queue = g_queue_new();
|
19784
|
57 return soapconn;
|
|
58 }
|
|
59
|
|
60 /*ssl soap connect callback*/
|
|
61 void
|
|
62 msn_soap_connect_cb(gpointer data, GaimSslConnection *gsc,
|
|
63 GaimInputCondition cond)
|
|
64 {
|
|
65 MsnSoapConn * soapconn;
|
|
66 MsnSession *session;
|
|
67
|
|
68 gaim_debug_info("MaYuan","Soap connection connected!\n");
|
|
69 soapconn = data;
|
|
70 g_return_if_fail(soapconn != NULL);
|
|
71
|
|
72 session = soapconn->session;
|
|
73 g_return_if_fail(session != NULL);
|
|
74
|
|
75 soapconn->gsc = gsc;
|
|
76
|
|
77 /*connection callback*/
|
|
78 if(soapconn->connect_cb != NULL){
|
|
79 soapconn->connect_cb(data,gsc,cond);
|
|
80 }
|
19804
|
81
|
19806
|
82 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTED);
|
19804
|
83 /*we do the SOAP request here*/
|
|
84 msn_soap_post_head_request(soapconn);
|
19784
|
85 }
|
|
86
|
|
87 /*ssl soap error callback*/
|
|
88 static void
|
|
89 msn_soap_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data)
|
|
90 {
|
|
91 MsnSoapConn * soapconn = data;
|
|
92 g_return_if_fail(data != NULL);
|
|
93 gaim_debug_info("MaYuan","Soap connection error!\n");
|
|
94 /*error callback*/
|
|
95 if(soapconn->error_cb != NULL){
|
|
96 soapconn->error_cb(gsc,error,data);
|
|
97 }
|
19806
|
98 msn_soap_set_process_step(soapconn, MSN_SOAP_UNCONNECTED);
|
19784
|
99 }
|
|
100
|
|
101 /*init the soap connection*/
|
|
102 void
|
|
103 msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl,
|
|
104 GaimSslInputFunction connect_cb,
|
|
105 GaimSslErrorFunction error_cb)
|
|
106 {
|
19808
|
107 gaim_debug_info("MaYuan","msn_soap_init...\n");
|
19784
|
108 soapconn->login_host = g_strdup(host);
|
|
109 soapconn->ssl_conn = ssl;
|
|
110 soapconn->connect_cb = connect_cb;
|
|
111 soapconn->error_cb = error_cb;
|
19808
|
112 gaim_debug_info("MaYuan","msn_soap_init...done\n");
|
19804
|
113 }
|
|
114
|
19806
|
115 /*connect the soap connection*/
|
19804
|
116 void
|
|
117 msn_soap_connect(MsnSoapConn *soapconn)
|
|
118 {
|
19784
|
119 if(soapconn->ssl_conn){
|
|
120 gaim_ssl_connect(soapconn->session->account, soapconn->login_host,
|
|
121 GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb, msn_soap_error_cb,
|
|
122 soapconn);
|
|
123 }else{
|
|
124 }
|
19809
|
125 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTING);
|
19784
|
126 }
|
|
127
|
19806
|
128 /*close the soap connection*/
|
19804
|
129 void
|
|
130 msn_soap_close(MsnSoapConn *soapconn)
|
|
131 {
|
|
132 if(soapconn->ssl_conn){
|
|
133 if(soapconn->gsc != NULL){
|
|
134 gaim_ssl_close(soapconn->gsc);
|
|
135 soapconn->gsc = NULL;
|
|
136 }
|
|
137 }else{
|
|
138 }
|
19806
|
139 msn_soap_set_process_step(soapconn,MSN_SOAP_UNCONNECTED);
|
19804
|
140 }
|
|
141
|
19784
|
142 /*destroy the soap connection*/
|
|
143 void
|
|
144 msn_soap_destroy(MsnSoapConn *soapconn)
|
|
145 {
|
19804
|
146 MsnSoapReq *request;
|
|
147
|
19791
|
148 if(soapconn->login_host)
|
|
149 g_free(soapconn->login_host);
|
|
150
|
|
151 if(soapconn->login_path)
|
|
152 g_free(soapconn->login_path);
|
19784
|
153
|
|
154 /*remove the write handler*/
|
|
155 if (soapconn->output_handler > 0){
|
|
156 gaim_input_remove(soapconn->output_handler);
|
|
157 }
|
|
158 /*remove the read handler*/
|
|
159 if (soapconn->input_handler > 0){
|
|
160 gaim_input_remove(soapconn->input_handler);
|
|
161 }
|
|
162 msn_soap_free_read_buf(soapconn);
|
|
163 msn_soap_free_write_buf(soapconn);
|
|
164
|
|
165 /*close ssl connection*/
|
19804
|
166 msn_soap_close(soapconn);
|
|
167
|
19806
|
168 /*process the unhandled soap request*/
|
19804
|
169 while ((request = g_queue_pop_head(soapconn->soap_queue)) != NULL){
|
|
170 msn_soap_request_free(request);
|
19788
|
171 }
|
19804
|
172 g_queue_free(soapconn->soap_queue);
|
19784
|
173 g_free(soapconn);
|
|
174 }
|
|
175
|
19785
|
176 /*check the soap is connected?
|
19806
|
177 * if connected return 1
|
19785
|
178 */
|
|
179 int
|
|
180 msn_soap_connected(MsnSoapConn *soapconn)
|
|
181 {
|
|
182 if(soapconn->ssl_conn){
|
19806
|
183 return (soapconn->gsc == NULL? 0 : 1);
|
19785
|
184 }
|
19806
|
185 return(soapconn->fd>0? 1 : 0);
|
19785
|
186 }
|
|
187
|
19784
|
188 /*read and append the content to the buffer*/
|
|
189 static gssize
|
|
190 msn_soap_read(MsnSoapConn *soapconn)
|
|
191 {
|
19809
|
192 gssize len,requested_len;
|
19796
|
193 char temp_buf[MSN_SOAP_READ_BUFF_SIZE];
|
19784
|
194
|
19809
|
195 // requested_len = (soapconn->need_to_read > 0) ? soapconn->need_to_read : MSN_SOAP_READ_BUFF_SIZE;
|
|
196 requested_len = MSN_SOAP_READ_BUFF_SIZE;
|
19784
|
197 if(soapconn->ssl_conn){
|
19809
|
198 len = gaim_ssl_read(soapconn->gsc, temp_buf,requested_len);
|
19784
|
199 }else{
|
19809
|
200 len = read(soapconn->fd, temp_buf,requested_len);
|
19784
|
201 }
|
|
202 if(len >0){
|
|
203 soapconn->read_buf = g_realloc(soapconn->read_buf,
|
|
204 soapconn->read_len + len + 1);
|
|
205 // strncpy(soapconn->read_buf + soapconn->read_len, temp_buf, len);
|
|
206 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len);
|
|
207 soapconn->read_len += len;
|
|
208 soapconn->read_buf[soapconn->read_len] = '\0';
|
|
209 }
|
19814
|
210 gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",len);
|
19784
|
211 // gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf);
|
19814
|
212 return len;
|
19784
|
213 }
|
|
214
|
|
215 /*read the whole SOAP server response*/
|
|
216 void
|
|
217 msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond)
|
|
218 {
|
|
219 MsnSoapConn *soapconn = data;
|
|
220 MsnSession *session;
|
|
221 int len;
|
|
222 char * body_start,*body_len;
|
|
223 char *length_start,*length_end;
|
|
224
|
19785
|
225 // gaim_debug_misc("MaYuan", "soap read cb\n");
|
19784
|
226 session = soapconn->session;
|
|
227 g_return_if_fail(session != NULL);
|
|
228
|
|
229 if (soapconn->input_handler == -1){
|
|
230 soapconn->input_handler = gaim_input_add(soapconn->gsc->fd,
|
|
231 GAIM_INPUT_READ, msn_soap_read_cb, soapconn);
|
|
232 }
|
|
233
|
|
234 /*read the request header*/
|
|
235 len = msn_soap_read(soapconn);
|
|
236 if (len < 0 && errno == EAGAIN){
|
|
237 return;
|
|
238 }else if (len < 0) {
|
|
239 gaim_debug_error("msn", "read Error!len:%d\n",len);
|
|
240 gaim_input_remove(soapconn->input_handler);
|
|
241 soapconn->input_handler = -1;
|
|
242 g_free(soapconn->read_buf);
|
|
243 soapconn->read_buf = NULL;
|
|
244 soapconn->read_len = 0;
|
|
245 /* TODO: error handling */
|
|
246 return;
|
|
247 }
|
|
248
|
|
249 if(soapconn->read_buf == NULL){
|
|
250 return;
|
|
251 }
|
|
252
|
19788
|
253 if (strstr(soapconn->read_buf, "HTTP/1.1 302") != NULL)
|
|
254 {
|
|
255 /* Redirect. */
|
|
256 char *location, *c;
|
|
257
|
19796
|
258 gaim_debug_error("MaYuan", "soap redirect\n");
|
19788
|
259 location = strstr(soapconn->read_buf, "Location: ");
|
|
260 if (location == NULL)
|
|
261 {
|
|
262 msn_soap_free_read_buf(soapconn);
|
|
263
|
|
264 return;
|
|
265 }
|
|
266 location = strchr(location, ' ') + 1;
|
|
267
|
|
268 if ((c = strchr(location, '\r')) != NULL)
|
|
269 *c = '\0';
|
|
270
|
|
271 /* Skip the http:// */
|
|
272 if ((c = strchr(location, '/')) != NULL)
|
|
273 location = c + 2;
|
|
274
|
|
275 if ((c = strchr(location, '/')) != NULL)
|
|
276 {
|
|
277 g_free(soapconn->login_path);
|
|
278 soapconn->login_path = g_strdup(c);
|
|
279
|
|
280 *c = '\0';
|
|
281 }
|
|
282
|
|
283 g_free(soapconn->login_host);
|
|
284 soapconn->login_host = g_strdup(location);
|
|
285
|
|
286 gaim_ssl_connect(session->account, soapconn->login_host,
|
|
287 GAIM_SSL_DEFAULT_PORT, msn_soap_connect_cb,
|
|
288 msn_soap_error_cb, soapconn);
|
19784
|
289 }
|
19788
|
290 else if (strstr(soapconn->read_buf, "HTTP/1.1 401 Unauthorized") != NULL)
|
|
291 {
|
|
292 const char *error;
|
19784
|
293
|
19796
|
294 gaim_debug_error("MaYuan", "soap 401\n");
|
19788
|
295 if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL)
|
|
296 {
|
|
297 if ((error = strstr(error, "cbtxt=")) != NULL)
|
|
298 {
|
|
299 const char *c;
|
|
300 char *temp;
|
|
301
|
|
302 error += strlen("cbtxt=");
|
|
303
|
|
304 if ((c = strchr(error, '\n')) == NULL)
|
|
305 c = error + strlen(error);
|
|
306
|
|
307 temp = g_strndup(error, c - error);
|
|
308 error = gaim_url_decode(temp);
|
|
309 g_free(temp);
|
|
310 }
|
|
311 }
|
19784
|
312
|
19788
|
313 msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, error);
|
|
314 }
|
|
315 else if (strstr(soapconn->read_buf, "HTTP/1.1 200 OK"))
|
|
316 {
|
|
317 /*OK! process the SOAP body*/
|
|
318 body_start = (char *)g_strstr_len(soapconn->read_buf, soapconn->read_len,"\r\n\r\n");
|
|
319 if(!body_start){
|
|
320 return;
|
|
321 }
|
|
322 body_start += 4;
|
|
323
|
|
324 // gaim_debug_misc("msn", "Soap Read: {%s}\n", soapconn->read_buf);
|
19784
|
325
|
19788
|
326 /* we read the content-length*/
|
|
327 length_start = strstr(soapconn->read_buf, "Content-Length: ");
|
|
328 length_start += strlen("Content-Length: ");
|
|
329 length_end = strstr(length_start, "\r\n");
|
|
330 body_len = g_strndup(length_start,length_end - length_start);
|
19784
|
331
|
19788
|
332 /*setup the conn body */
|
|
333 soapconn->body = body_start;
|
|
334 soapconn->body_len = atoi(body_len);
|
19796
|
335 gaim_debug_misc("MaYuan","SOAP Read length :%d,body len:%d\n",soapconn->read_len,soapconn->body_len);
|
19788
|
336
|
19809
|
337 soapconn->need_to_read = (body_start - soapconn->read_buf +soapconn->body_len) - soapconn->read_len;
|
19796
|
338 if(soapconn->read_len < body_start - soapconn->read_buf + soapconn->body_len){
|
19809
|
339 // if(soapconn->need_to_read >0){
|
19804
|
340 return;
|
19788
|
341 }
|
|
342 g_free(body_len);
|
19784
|
343
|
19785
|
344 #if 1
|
19788
|
345 /*remove the read handler*/
|
|
346 gaim_input_remove(soapconn->input_handler);
|
|
347 soapconn->input_handler = -1;
|
19785
|
348 #endif
|
|
349
|
19788
|
350 /*call the read callback*/
|
|
351 if(soapconn->read_cb != NULL){
|
19804
|
352 soapconn->read_cb(soapconn,source,0);
|
19788
|
353 }
|
19808
|
354 /*clear the read buffer*/
|
|
355 msn_soap_free_read_buf(soapconn);
|
19810
|
356 #if 1
|
|
357 // msn_soap_close(soapconn);
|
|
358 #endif
|
19804
|
359 /*Process the next queued SOAP request*/
|
19811
|
360 // msn_soap_post_head_request(soapconn);
|
19788
|
361 }
|
19796
|
362 return;
|
19784
|
363 }
|
|
364
|
|
365 void
|
|
366 msn_soap_free_read_buf(MsnSoapConn *soapconn)
|
|
367 {
|
|
368 if(soapconn->read_buf){
|
|
369 g_free(soapconn->read_buf);
|
|
370 }
|
|
371 soapconn->read_buf = NULL;
|
|
372 soapconn->read_len = 0;
|
19809
|
373 soapconn->need_to_read = 0;
|
19784
|
374 }
|
|
375
|
|
376 void
|
|
377 msn_soap_free_write_buf(MsnSoapConn *soapconn)
|
|
378 {
|
|
379 if(soapconn->write_buf){
|
|
380 g_free(soapconn->write_buf);
|
|
381 }
|
|
382 soapconn->write_buf = NULL;
|
|
383 soapconn->written_len = 0;
|
|
384 }
|
|
385
|
|
386 /*Soap write process func*/
|
|
387 static void
|
|
388 msn_soap_write_cb(gpointer data, gint source, GaimInputCondition cond)
|
|
389 {
|
|
390 MsnSoapConn *soapconn = data;
|
|
391 int len, total_len;
|
|
392
|
19796
|
393 g_return_if_fail(soapconn != NULL);
|
|
394 if(soapconn->write_buf == NULL){
|
|
395 gaim_debug_error("MaYuan","soap buffer is NULL\n");
|
|
396 gaim_input_remove(soapconn->output_handler);
|
|
397 soapconn->output_handler = -1;
|
|
398 return;
|
|
399 }
|
19784
|
400 total_len = strlen(soapconn->write_buf);
|
|
401
|
|
402 /*
|
|
403 * write the content to SSL server,
|
|
404 */
|
|
405 len = gaim_ssl_write(soapconn->gsc,
|
|
406 soapconn->write_buf + soapconn->written_len,
|
|
407 total_len - soapconn->written_len);
|
|
408
|
|
409 if (len < 0 && errno == EAGAIN)
|
|
410 return;
|
|
411 else if (len <= 0){
|
|
412 /*SSL write error!*/
|
|
413 gaim_input_remove(soapconn->output_handler);
|
|
414 soapconn->output_handler = -1;
|
|
415 /* TODO: notify of the error */
|
|
416 return;
|
|
417 }
|
|
418 soapconn->written_len += len;
|
|
419
|
|
420 if (soapconn->written_len < total_len)
|
|
421 return;
|
|
422
|
|
423 gaim_input_remove(soapconn->output_handler);
|
|
424 soapconn->output_handler = -1;
|
|
425
|
|
426 /*clear the write buff*/
|
|
427 msn_soap_free_write_buf(soapconn);
|
|
428
|
|
429 /* Write finish!
|
|
430 * callback for write done
|
|
431 */
|
|
432 if(soapconn->written_cb != NULL){
|
|
433 soapconn->written_cb(soapconn, source, 0);
|
|
434 }
|
19810
|
435 /*maybe we need to read the input?*/
|
|
436 msn_soap_read_cb(soapconn,source,0);
|
19784
|
437 }
|
|
438
|
|
439 /*write the buffer to SOAP connection*/
|
|
440 void
|
|
441 msn_soap_write(MsnSoapConn * soapconn, char *write_buf, GaimInputFunction written_cb)
|
|
442 {
|
|
443 soapconn->write_buf = write_buf;
|
|
444 soapconn->written_len = 0;
|
|
445 soapconn->written_cb = written_cb;
|
19785
|
446
|
|
447 /*clear the read buffer first*/
|
19784
|
448 /*start the write*/
|
|
449 soapconn->output_handler = gaim_input_add(soapconn->gsc->fd, GAIM_INPUT_WRITE,
|
|
450 msn_soap_write_cb, soapconn);
|
|
451 msn_soap_write_cb(soapconn, soapconn->gsc->fd, GAIM_INPUT_WRITE);
|
|
452 }
|
|
453
|
19804
|
454 /* New a soap request*/
|
|
455 MsnSoapReq *
|
|
456 msn_soap_request_new(const char *host,const char *post_url,const char *soap_action,
|
|
457 const char *body,
|
|
458 GaimInputFunction read_cb,GaimInputFunction written_cb)
|
|
459 {
|
|
460 MsnSoapReq *request;
|
|
461
|
|
462 request = g_new0(MsnSoapReq, 1);
|
|
463 request->id = 0;
|
|
464
|
|
465 request->login_host = g_strdup(host);
|
|
466 request->login_path = g_strdup(post_url);
|
|
467 request->soap_action = g_strdup(soap_action);
|
|
468 request->body = g_strdup(body);
|
|
469 request->read_cb = read_cb;
|
|
470 request->written_cb = written_cb;
|
|
471
|
|
472 return request;
|
|
473 }
|
|
474
|
|
475 /*free a soap request*/
|
19785
|
476 void
|
19804
|
477 msn_soap_request_free(MsnSoapReq *request)
|
|
478 {
|
|
479 g_return_if_fail(request != NULL);
|
|
480
|
|
481 g_free(request->login_host);
|
|
482 g_free(request->login_path);
|
|
483 g_free(request->soap_action);
|
|
484 g_free(request->body);
|
|
485 request->read_cb = NULL;
|
|
486 request->written_cb = NULL;
|
|
487
|
|
488 g_free(request);
|
|
489 }
|
|
490
|
19807
|
491 /*post the soap request queue's head request*/
|
19804
|
492 void
|
|
493 msn_soap_post_head_request(MsnSoapConn *soapconn)
|
|
494 {
|
19810
|
495 g_return_if_fail(soapconn->soap_queue != NULL);
|
|
496
|
19804
|
497 if(!g_queue_is_empty(soapconn->soap_queue)){
|
|
498 MsnSoapReq *request;
|
|
499 if((request = g_queue_pop_head(soapconn->soap_queue)) != NULL){
|
|
500 msn_soap_post_request(soapconn,request);
|
|
501 }
|
|
502 }
|
19806
|
503 msn_soap_set_process_step(soapconn,MSN_SOAP_CONNECTED_IDLE);
|
19804
|
504 }
|
|
505
|
19807
|
506 /*post the soap request ,
|
|
507 * if not connected, Connected first.
|
|
508 */
|
19804
|
509 void
|
19806
|
510 msn_soap_post(MsnSoapConn *soapconn,MsnSoapReq *request,
|
|
511 MsnSoapConnectInitFunction msn_soap_init_func)
|
19804
|
512 {
|
|
513 g_queue_push_tail(soapconn->soap_queue, request);
|
19809
|
514 if(!msn_soap_connected(soapconn)&&(soapconn->step == MSN_SOAP_UNCONNECTED)){
|
19804
|
515 /*not connected?connect it first*/
|
19806
|
516 gaim_debug_info("Ma Yuan","soap is not connected!\n");
|
|
517 msn_soap_init_func(soapconn);
|
19804
|
518 msn_soap_connect(soapconn);
|
|
519 return;
|
|
520 }
|
19806
|
521 gaim_debug_info("Ma Yuan","soap connected!\n");
|
19804
|
522 /*if connected, what we only needed to do is to queue the request,
|
|
523 * when SOAP request in the queue processed done, will do this command.
|
|
524 * we just waiting...
|
|
525 */
|
19806
|
526 if(soapconn->step == MSN_SOAP_CONNECTED_IDLE){
|
|
527 msn_soap_post_head_request(soapconn);
|
|
528 }
|
19804
|
529 }
|
|
530
|
|
531 /*Post the soap request action*/
|
|
532 void
|
|
533 msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request)
|
19785
|
534 {
|
|
535 char * soap_head = NULL;
|
|
536 char * request_str = NULL;
|
|
537
|
19814
|
538 gaim_debug_info("MaYuan","msn_soap_post_request()...\n");
|
19806
|
539 msn_soap_set_process_step(soapconn,MSN_SOAP_PROCESSING);
|
19785
|
540 soap_head = g_strdup_printf(
|
|
541 "POST %s HTTP/1.1\r\n"
|
|
542 "SOAPAction: %s\r\n"
|
|
543 "Content-Type:text/xml; charset=utf-8\r\n"
|
|
544 "Cookie: MSPAuth=%s\r\n"
|
|
545 "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
|
|
546 "Accept: text/*\r\n"
|
|
547 "Host: %s\r\n"
|
|
548 "Content-Length: %d\r\n"
|
|
549 "Connection: Keep-Alive\r\n"
|
|
550 "Cache-Control: no-cache\r\n\r\n",
|
19804
|
551 request->login_path,
|
|
552 request->soap_action,
|
19785
|
553 soapconn->session->passport_info.mspauth,
|
19804
|
554 request->login_host,
|
|
555 strlen(request->body)
|
19785
|
556 );
|
19804
|
557 request_str = g_strdup_printf("%s%s", soap_head,request->body);
|
19785
|
558 g_free(soap_head);
|
|
559
|
|
560 /*free read buffer*/
|
|
561 msn_soap_free_read_buf(soapconn);
|
19788
|
562 gaim_debug_info("MaYuan","send to server{%s}\n",request_str);
|
19804
|
563 msn_soap_write(soapconn,request_str,request->written_cb);
|
19785
|
564 }
|
|
565
|