Changeset 239 for trunk/instant_messenger/inc/Jabber.abstract.php
- Timestamp:
- 03/25/08 14:43:28 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/Jabber.abstract.php
r227 r239 48 48 fwrite($socket, "{$USER}@{$SERVER}##{$pPassword}##{$pConnectionType}"); 49 49 50 #sleep(1);51 52 50 $return = fread($socket, 3); 53 #var_dump($return);54 #$return = "new";55 51 56 52 if ( $return == "new" ) 57 53 { 58 $xml = "<?xml version='1.0' encoding='UTF-8'?>";54 $xml = "<?xml version='1.0' ?>"; 59 55 $xml .= "<stream:stream to='" . $SERVER . "' xmlns='jabber:client' "; 60 $xml .= "xmlns:stream='http://etherx.jabber.org/streams' >";//version='1.0'>";56 $xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"; 61 57 62 58 if ( $this->write($xml) === false ) … … 144 140 throw new Exception('[starttls] #1 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . ' :: ' . __LINE__); 145 141 146 if ( ($xml = $this->read()) === false ) 147 throw new Exception('[starttls] #2 it isn\'t possible read the socket. File: ' . __FILE__ . ' :: ' . __LINE__); 148 149 if ( !preg_match('/<proceed.*\/>/', $xml, $matches) ) 150 throw new Exception('[starttls] #3 can\'t start tls in the socket ' .$this->_socket . '. File: ' . __FILE__ . ' :: ' . __LINE__); 151 152 stream_socket_enable_crypto($this->_socket, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT); 142 usleep(50000); 143 fread($this->_socket, 4096); 144 145 stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); 153 146 154 147 $xml = "<?xml version='1.0' encoding='UTF-8'?>"; 155 148 $xml .= "<stream:stream to='" . $this->_server . "' xmlns='jabber:client' "; 156 149 $xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"; 150 157 151 if ( $this->write($xml) === false ) 158 throw new Exception('[starttls] #4 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . ' :: ' . __LINE__); 159 160 usleep(90000); 161 $this->blocking($this->_socket, 0); 162 163 if ( ($xml = $this->read()) === false ) 164 throw new Exception('[starttls] #5 it isn\'t possible read the socket. File: ' . __FILE__ . ' :: ' . __LINE__); 165 152 throw new Exception('[starttls] #2 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . ' :: ' . __LINE__); 153 154 usleep(50000); 155 156 fread($this->_socket, 4096); 157 158 usleep(50000); 159 160 fread($this->_socket, 4096); 161 166 162 if ( !$this->_plain() ) 167 throw new Exception('[starttls] # 6it isn\'t possible carry out the verification. File: ' . __FILE__ . ' :: ' . __LINE__);163 throw new Exception('[starttls] #3 it isn\'t possible carry out the verification. File: ' . __FILE__ . ' :: ' . __LINE__); 168 164 169 165 return true;
Note: See TracChangeset
for help on using the changeset viewer.