You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/22 02:01:50 UTC

[james-project] 19/29: JAMES-3715 Writing on the first context bypasses the SSL encoder

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 98fc22177e69558b1821064d9d4a6d27c1054d44
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Mar 16 15:33:19 2022 +0700

    JAMES-3715 Writing on the first context bypasses the SSL encoder
---
 .../java/org/apache/james/imapserver/netty/NettyImapSession.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
index d92ff14..2a5cb0d 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
@@ -157,7 +157,7 @@ public class NettyImapSession implements ImapSession, NettyConstants {
             return false;
         }
         channel.config().setAutoRead(false);
-        writeOnTheEventLoop(statusResponse);
+        write(statusResponse);
 
         SslHandler filter = new SslHandler(secure.createSSLEngine(), false);
 
@@ -169,7 +169,7 @@ public class NettyImapSession implements ImapSession, NettyConstants {
         return true;
     }
 
-    private void writeOnTheEventLoop(ImmutableStatusResponse statusResponse) {
+    private void write(ImmutableStatusResponse statusResponse) {
         try {
             new StatusResponseEncoder(new DefaultLocalizer()).encode(statusResponse,
                 new ImapResponseComposerImpl(new EventLoopImapResponseWriter(channel), BUFFER_SIZE));
@@ -188,7 +188,7 @@ public class NettyImapSession implements ImapSession, NettyConstants {
         @Override
         public void write(byte[] buffer) {
             if (channel.isActive()) {
-                channel.pipeline().firstContext().writeAndFlush(Unpooled.wrappedBuffer(buffer));
+                channel.writeAndFlush(Unpooled.wrappedBuffer(buffer));
             }
         }
 
@@ -216,7 +216,7 @@ public class NettyImapSession implements ImapSession, NettyConstants {
         }
 
         channel.config().setAutoRead(false);
-        writeOnTheEventLoop(response);
+        write(response);
         ZlibDecoder decoder = new JZlibDecoder(ZlibWrapper.NONE);
         ZlibEncoder encoder = new JZlibEncoder(ZlibWrapper.NONE, 5);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org