comparison libpurple/protocols/jabber/bosh.c @ 26272:fcee93c74230

BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream. Since we always require the connection from CM to server to be secure, allow BOSH+HTTPS to pass 'Require SSL/TLS'.
author Paul Aurich <paul@darkrain42.org>
date Mon, 23 Mar 2009 00:38:20 +0000
parents 31bb0d6e7f7e
children 79ca1cf55d9d
comparison
equal deleted inserted replaced
26271:07e22e1897f6 26272:fcee93c74230
214 } 214 }
215 215
216 g_free(conn); 216 g_free(conn);
217 } 217 }
218 218
219 gboolean jabber_bosh_connection_is_ssl(PurpleBOSHConnection *conn)
220 {
221 return conn->ssl;
222 }
223
219 void jabber_bosh_connection_close(PurpleBOSHConnection *conn) 224 void jabber_bosh_connection_close(PurpleBOSHConnection *conn)
220 { 225 {
221 jabber_bosh_connection_send_native(conn, PACKET_TERMINATE, NULL); 226 jabber_bosh_connection_send_native(conn, PACKET_TERMINATE, NULL);
222 } 227 }
223 228
578 /* 583 /*
579 * Well, then. Fine! I never liked you anyway, server! I was cheating on you 584 * Well, then. Fine! I never liked you anyway, server! I was cheating on you
580 * with AIM! 585 * with AIM!
581 */ 586 */
582 conn->ready = FALSE; 587 conn->ready = FALSE;
583 conn->fd = -1; 588 if (conn->psc) {
584 purple_input_remove(conn->ie_handle); 589 purple_ssl_close(conn->psc);
585 conn->ie_handle = 0; 590 conn->psc = NULL;
591 } else if (conn->fd >= 0) {
592 close(conn->fd);
593 conn->fd = -1;
594 }
595
596 if (conn->ie_handle) {
597 purple_input_remove(conn->ie_handle);
598 conn->ie_handle = 0;
599 }
586 600
587 if (conn->bosh->pipelining) 601 if (conn->bosh->pipelining)
588 /* Hmmmm, fall back to multiple connections */ 602 /* Hmmmm, fall back to multiple connections */
589 conn->bosh->pipelining = FALSE; 603 conn->bosh->pipelining = FALSE;
590 604
684 698
685 if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) { 699 if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) {
686 if (cnt < 0) 700 if (cnt < 0)
687 purple_debug_info("jabber", "bosh read=%d, errno=%d\n", cnt, errno); 701 purple_debug_info("jabber", "bosh read=%d, errno=%d\n", cnt, errno);
688 else 702 else
689 purple_debug_info("jabber", "bosh server closed connection\n"); 703 purple_debug_info("jabber", "bosh server closed the connection\n");
690 704
691 /* 705 /*
692 * If the socket is closed, the processing really needs to know about 706 * If the socket is closed, the processing really needs to know about
693 * it. Handle that now (it will be handled again post-processing). 707 * it. Handle that now (it will be handled again post-processing).
694 */ 708 */