Mercurial > pidgin
comparison src/protocols/msn/soap.c @ 19814:78fea5515221
[gaim-migrate @ 16956]
middle stage of multiple soap request
why always read 0 bytes?
committed by MaYuan<mayuan2006@gmail.com>
committer: Ethan Blanton <elb@pidgin.im>
author | Ma Yuan <mayuan2006@gmail.com> |
---|---|
date | Mon, 21 Aug 2006 18:58:31 +0000 |
parents | 4c7aa3b07f42 |
children | 1aa5494587e8 |
comparison
equal
deleted
inserted
replaced
19813:6bc69cd68d3c | 19814:78fea5515221 |
---|---|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 */ | 25 */ |
26 #include "msn.h" | 26 #include "msn.h" |
27 #include "soap.h" | 27 #include "soap.h" |
28 | 28 |
29 /*local function prototype*/ | |
30 void msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step); | |
31 | |
29 /*setup the soap process step*/ | 32 /*setup the soap process step*/ |
30 void | 33 void |
31 msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step) | 34 msn_soap_set_process_step(MsnSoapConn *soapconn, MsnSoapStep step) |
32 { | 35 { |
33 soapconn->step = step; | 36 soapconn->step = step; |
185 /*read and append the content to the buffer*/ | 188 /*read and append the content to the buffer*/ |
186 static gssize | 189 static gssize |
187 msn_soap_read(MsnSoapConn *soapconn) | 190 msn_soap_read(MsnSoapConn *soapconn) |
188 { | 191 { |
189 gssize len,requested_len; | 192 gssize len,requested_len; |
190 gssize total_len = 0; | |
191 char temp_buf[MSN_SOAP_READ_BUFF_SIZE]; | 193 char temp_buf[MSN_SOAP_READ_BUFF_SIZE]; |
192 | 194 |
193 // requested_len = (soapconn->need_to_read > 0) ? soapconn->need_to_read : MSN_SOAP_READ_BUFF_SIZE; | 195 // requested_len = (soapconn->need_to_read > 0) ? soapconn->need_to_read : MSN_SOAP_READ_BUFF_SIZE; |
194 requested_len = MSN_SOAP_READ_BUFF_SIZE; | 196 requested_len = MSN_SOAP_READ_BUFF_SIZE; |
195 if(soapconn->ssl_conn){ | 197 if(soapconn->ssl_conn){ |
196 len = gaim_ssl_read(soapconn->gsc, temp_buf,requested_len); | 198 len = gaim_ssl_read(soapconn->gsc, temp_buf,requested_len); |
197 }else{ | 199 }else{ |
198 len = read(soapconn->fd, temp_buf,requested_len); | 200 len = read(soapconn->fd, temp_buf,requested_len); |
199 } | 201 } |
200 if(len >0){ | 202 if(len >0){ |
201 total_len += len; | |
202 soapconn->read_buf = g_realloc(soapconn->read_buf, | 203 soapconn->read_buf = g_realloc(soapconn->read_buf, |
203 soapconn->read_len + len + 1); | 204 soapconn->read_len + len + 1); |
204 // strncpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); | 205 // strncpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); |
205 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); | 206 memcpy(soapconn->read_buf + soapconn->read_len, temp_buf, len); |
206 soapconn->read_len += len; | 207 soapconn->read_len += len; |
207 soapconn->read_buf[soapconn->read_len] = '\0'; | 208 soapconn->read_buf[soapconn->read_len] = '\0'; |
208 } | 209 } |
209 gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",total_len); | 210 gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",len); |
210 // gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf); | 211 // gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf); |
211 return total_len; | 212 return len; |
212 } | 213 } |
213 | 214 |
214 /*read the whole SOAP server response*/ | 215 /*read the whole SOAP server response*/ |
215 void | 216 void |
216 msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond) | 217 msn_soap_read_cb(gpointer data, gint source, GaimInputCondition cond) |
532 msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request) | 533 msn_soap_post_request(MsnSoapConn *soapconn,MsnSoapReq *request) |
533 { | 534 { |
534 char * soap_head = NULL; | 535 char * soap_head = NULL; |
535 char * request_str = NULL; | 536 char * request_str = NULL; |
536 | 537 |
537 gaim_debug_info("MaYuan","msn_soap_post()...\n"); | 538 gaim_debug_info("MaYuan","msn_soap_post_request()...\n"); |
538 msn_soap_set_process_step(soapconn,MSN_SOAP_PROCESSING); | 539 msn_soap_set_process_step(soapconn,MSN_SOAP_PROCESSING); |
539 soap_head = g_strdup_printf( | 540 soap_head = g_strdup_printf( |
540 "POST %s HTTP/1.1\r\n" | 541 "POST %s HTTP/1.1\r\n" |
541 "SOAPAction: %s\r\n" | 542 "SOAPAction: %s\r\n" |
542 "Content-Type:text/xml; charset=utf-8\r\n" | 543 "Content-Type:text/xml; charset=utf-8\r\n" |