Subject: StartTLS before Compress
Hello, first of all, thank you very much for this great SDK.
I got my own xmpp server (ejabberd 2.1.4) and i have discovered, that if I use StartTLS+Compress, client with agsXMPP (latest trunk) connects compressed without StartTLS. I would like to share my patch with all.
--- agsxmpp/XmppClientConnection.cs Wed Jun 09 13:21:07 2010
+++ agsxmpp/XmppClientConnection_new.cs Wed Jun 09 13:32:44 2010
@@ -1387,7 +1387,14 @@
// Stream Features
// StartTLS stuff
Features f = e as Features;
- if (m_UseCompression &&
+#if SSL || MONOSSL || BCCRYPTO
+ if (f.SupportsStartTls && m_UseStartTLS)
+ {
+ DoChangeXmppConnectionState(XmppConnectionState.Securing);
+ this.Send(new StartTls());
+ }
+#endif
+ else if (m_UseCompression &&
f.SupportsCompression &&
f.Compression.SupportsMethod(CompressionMethod.zlib))
{
@@ -1397,13 +1404,6 @@
DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
this.Send(new Compress(CompressionMethod.zlib));
}
-#if SSL || MONOSSL || BCCRYPTO
- else if (f.SupportsStartTls && m_UseStartTLS)
- {
- DoChangeXmppConnectionState(XmppConnectionState.Securing);
- this.Send(new StartTls());
- }
-#endif
else if (f.SupportsRegistration && m_RegisterAccount)
{
// Do registration after TLS when possible
according to comments, it was correct in past. just switch "if compress" with "if starttls". may be server changed the way of sending stream features, but i think this is the right way, starttls, then compress
I got my own xmpp server (ejabberd 2.1.4) and i have discovered, that if I use StartTLS+Compress, client with agsXMPP (latest trunk) connects compressed without StartTLS. I would like to share my patch with all.
--- agsxmpp/XmppClientConnection.cs Wed Jun 09 13:21:07 2010
+++ agsxmpp/XmppClientConnection_new.cs Wed Jun 09 13:32:44 2010
@@ -1387,7 +1387,14 @@
// Stream Features
// StartTLS stuff
Features f = e as Features;
- if (m_UseCompression &&
+#if SSL || MONOSSL || BCCRYPTO
+ if (f.SupportsStartTls && m_UseStartTLS)
+ {
+ DoChangeXmppConnectionState(XmppConnectionState.Securing);
+ this.Send(new StartTls());
+ }
+#endif
+ else if (m_UseCompression &&
f.SupportsCompression &&
f.Compression.SupportsMethod(CompressionMethod.zlib))
{
@@ -1397,13 +1404,6 @@
DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
this.Send(new Compress(CompressionMethod.zlib));
}
-#if SSL || MONOSSL || BCCRYPTO
- else if (f.SupportsStartTls && m_UseStartTLS)
- {
- DoChangeXmppConnectionState(XmppConnectionState.Securing);
- this.Send(new StartTls());
- }
-#endif
else if (f.SupportsRegistration && m_RegisterAccount)
{
// Do registration after TLS when possible
according to comments, it was correct in past. just switch "if compress" with "if starttls". may be server changed the way of sending stream features, but i think this is the right way, starttls, then compress
mikie
Show profile
Link to this post

