metajack / libstrophe

The libstrophe repository has moved to https://github.com/strophe/libstrophe
http://strophe.im/libstrophe
Other
135 stars 49 forks source link

Bug when using SSL communication #12

Closed vladmihaisima closed 12 years ago

vladmihaisima commented 12 years ago

In event.c the processing of new data is not working always for SSL connections.

More specifically, the select is made on the 'real' socket (conn->sock), not on the encrypted one. More over there is a 4096 bytes buffer read for each return of select. The following scenario will not work in case of SSL connections:

The fix adds a new function "tls_pending" which will return the number of bytes that can be returned from the descrypted tls buffer. I provided implementations for all 3 tls backends, but tested only openssl and windows. The gnutls implementation is trivial so probably there will not be problems with it.