Mercurial > pidgin
comparison libpurple/protocols/msn/httpconn.c @ 27646:8e31eec7b621
Propagate connect errors from the MSN proxy callback to the servconn error
handling function so that the real proxy error is displayed instead of a
generic "Connect Error".
Fixes #8280.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 21 Jul 2009 04:31:27 +0000 |
parents | 35b6fd563056 |
children | 351d07aefb09 |
comparison
equal
deleted
inserted
replaced
27645:97ba0d9e6e54 | 27646:8e31eec7b621 |
---|---|
291 return; | 291 return; |
292 if (len <= 0) { | 292 if (len <= 0) { |
293 purple_debug_error("msn", "HTTP: servconn %03d read error, " | 293 purple_debug_error("msn", "HTTP: servconn %03d read error, " |
294 "len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n", | 294 "len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n", |
295 servconn->num, len, error, g_strerror(errno)); | 295 servconn->num, len, error, g_strerror(errno)); |
296 msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ); | 296 msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); |
297 | 297 |
298 return; | 298 return; |
299 } | 299 } |
300 | 300 |
301 buf[len] = '\0'; | 301 buf[len] = '\0'; |
307 if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len, | 307 if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len, |
308 &result_msg, &result_len, &error)) | 308 &result_msg, &result_len, &error)) |
309 { | 309 { |
310 /* Either we must wait for more input, or something went wrong */ | 310 /* Either we must wait for more input, or something went wrong */ |
311 if (error) | 311 if (error) |
312 msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ); | 312 msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); |
313 | 313 |
314 return; | 314 return; |
315 } | 315 } |
316 | 316 |
317 if (error) | 317 if (error) |
318 { | 318 { |
319 purple_debug_error("msn", "HTTP: Special error\n"); | 319 purple_debug_error("msn", "HTTP: Special error\n"); |
320 msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ); | 320 msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); |
321 | 321 |
322 return; | 322 return; |
323 } | 323 } |
324 | 324 |
325 g_free(httpconn->rx_buf); | 325 g_free(httpconn->rx_buf); |
366 if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) | 366 if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) |
367 /* No worries */ | 367 /* No worries */ |
368 return; | 368 return; |
369 | 369 |
370 /* Error! */ | 370 /* Error! */ |
371 msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE); | 371 msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL); |
372 return; | 372 return; |
373 } | 373 } |
374 | 374 |
375 purple_circ_buffer_mark_read(httpconn->tx_buf, ret); | 375 purple_circ_buffer_mark_read(httpconn->tx_buf, ret); |
376 | 376 |
392 errno = EAGAIN; | 392 errno = EAGAIN; |
393 } | 393 } |
394 | 394 |
395 if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) | 395 if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) |
396 { | 396 { |
397 msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE); | 397 msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL); |
398 return FALSE; | 398 return FALSE; |
399 } | 399 } |
400 | 400 |
401 if (res < 0 || res < data_len) | 401 if (res < 0 || res < data_len) |
402 { | 402 { |
670 } | 670 } |
671 else | 671 else |
672 { | 672 { |
673 purple_debug_error("msn", "HTTP: Connection error: %s\n", | 673 purple_debug_error("msn", "HTTP: Connection error: %s\n", |
674 error_message ? error_message : "(null)"); | 674 error_message ? error_message : "(null)"); |
675 msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT); | 675 msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT, error_message); |
676 } | 676 } |
677 } | 677 } |
678 | 678 |
679 gboolean | 679 gboolean |
680 msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port) | 680 msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port) |