libpurple/protocols/msn/soap.c

changeset 24216
aa2a6eaa0afe
parent 24075
7c07336ce376
child 24251
c463b357854c
child 24289
eee560dd9d2c
equal deleted inserted replaced
24212:3ca5cc4d3caf 24216:aa2a6eaa0afe
266 /* This buffer needs to be larger than any packets received from 266 /* This buffer needs to be larger than any packets received from
267 login.live.com or Adium will fail to receive the packet 267 login.live.com or Adium will fail to receive the packet
268 (something weird with the login.live.com server). With NSS it works 268 (something weird with the login.live.com server). With NSS it works
269 fine, so I believe it's some bug with OS X */ 269 fine, so I believe it's some bug with OS X */
270 char buf[16 * 1024]; 270 char buf[16 * 1024];
271 gsize cursor;
271 272
272 if (conn->message == NULL) { 273 if (conn->message == NULL) {
273 conn->message = msn_soap_message_new(NULL, NULL); 274 conn->message = msn_soap_message_new(NULL, NULL);
274 } 275 }
275 276
276 if (conn->buf == NULL) { 277 if (conn->buf == NULL) {
277 conn->buf = g_string_new_len(buf, 0); 278 conn->buf = g_string_new_len(buf, 0);
278 } 279 }
279 280
281 cursor = conn->buf->len;
280 while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) { 282 while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) {
281 purple_debug_info("soap", "read %d bytes\n", cnt); 283 purple_debug_info("soap", "read %d bytes\n", cnt);
282 count += cnt; 284 count += cnt;
283 g_string_append_len(conn->buf, buf, cnt); 285 g_string_append_len(conn->buf, buf, cnt);
284 } 286 }
287 #ifndef MSN_UNSAFE_DEBUG
288 if (conn->current_request->secure)
289 purple_debug_misc("soap", "Received secure request.\n");
290 else
291 #endif
292 if (count != 0)
293 purple_debug_misc("soap", "current %s\n", conn->buf->str + cursor);
285 294
286 /* && count is necessary for Adium, on OS X the last read always 295 /* && count is necessary for Adium, on OS X the last read always
287 return an error, so we want to proceed anyway. See #5212 for 296 return an error, so we want to proceed anyway. See #5212 for
288 discussion on this and the above buffer size issues */ 297 discussion on this and the above buffer size issues */
289 if(cnt < 0 && errno == EAGAIN && count == 0) 298 if(cnt < 0 && errno == EAGAIN && count == 0)
307 static void 316 static void
308 msn_soap_process(MsnSoapConnection *conn) { 317 msn_soap_process(MsnSoapConnection *conn) {
309 gboolean handled = FALSE; 318 gboolean handled = FALSE;
310 char *cursor; 319 char *cursor;
311 char *linebreak; 320 char *linebreak;
312
313 #ifndef MSN_UNSAFE_DEBUG
314 if (conn->current_request->secure)
315 purple_debug_misc("soap", "Received secure request.\n");
316 else
317 #endif
318 purple_debug_misc("soap", "current %s\n", conn->buf->str);
319 321
320 cursor = conn->buf->str + conn->handled_len; 322 cursor = conn->buf->str + conn->handled_len;
321 323
322 if (!conn->headers_done) { 324 if (!conn->headers_done) {
323 while ((linebreak = strstr(cursor, "\r\n")) != NULL) { 325 while ((linebreak = strstr(cursor, "\r\n")) != NULL) {

mercurial