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